You shouldn't set a max sdk. You can set minSdk to 18, and targetSdk to 21.
If you set a max, that means if there's a new android version, people won't
be able to download your app, you'll have to make an update.
As for the error you get, it's mainly a lint error. If the code is in an if
statement like you showed, there's no reason someone with API 18 enters
into this if statement. You'll just have to add @SuppressLint("NewApi")
before your method.
Have a look at this stackoverflow page, it'll help.
http://stackoverflow.com/questions/11592820/writing-backwards-compatible-android-code
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.