Reputation: 4441
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!
Upvotes: 5
Views: 2910
Reputation: 668
Probably it will works when the https://code.google.com/p/android/issues/detail?id=56427 will be solved
Upvotes: 0
Reputation: 758
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.
Upvotes: 5
Reputation: 66
If it is intoduced in api level9 then try this.
< uses-sdk android:minSdkVersion="9" android:targetSdkVersion="10"/>
Upvotes: 0