I compile against Android 4.2 (API 17), in my Manifest I have:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="10"/>
In code I use:
String first = sdf.format(new Date(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime));
Field firstInstallTime was introduced in API 9.
Lint does not warn me, i.e. that this field is not valid in API 8. What am I missing, how should one detect this?
If I compile against Android 2.2 (API 8), I find the error and a bunch of extra errors due to new features used (> API 8) and the project won't compile.
(I'm aware of handling such things in runtime with for example Build.VERSION.SDK_INT)
What's the best way of working?
Why is lint not working?
Thanks!
This answer may be late but You should check your lint preferences
Right click on project -> Properties -> Android Lint Preferences
then search for min in the searchbox and select "UsesMinSDKAttributes"
Finally select "Include all" button. Hopefully the check had just been surpressed (Something I've had to do just to fix a silly lint error)
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With