that's because "firstInstallTime" was introduced on API 9 (gingerbread) and above:
http://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime
in order to avoid such errors, it is advised to run a LINT check (using the "V" button near the run button, for example). LINT has plenty of errors and warnings that could help you get a better code. you can even make it check for problems on each save operation.
Of course, it has bugs and missing checks too, even for this matter.