Reputation: 37
I have a question about minSDK. I took a project example in here: Contacts Providers.
This project has a minSDK = 5
. And in styles.xml
some attribute which require higher sdk version like:
android:textAllCaps --> min 14
android:fontFamily --> min 16
But that project so no any error and run fine.
When I copy some style into my styles.xml
in my project. It causes an error:
android:textAllCaps requires API level 14 (current min is 11)
...
Can someone help me with the compile error?
Upvotes: 1
Views: 572
Reputation: 1020
EDIT: previously misunderstood the question/scenario. Sorry!
I think the problem is your Target API level. Make sure that the target api level is at least the level in which the APIs were introduced. In this case, 14.
If you build from command line you would just do
android update project -p -t
(I think what the command does is just update project.properties and sets target=android-14)
Upvotes: 0
Reputation: 905
You can use those styles in the respective minSDK version by using resource qualifiers. In your resource directory: there is base styles
, add folders to res/styles-v14
(for use in ice-cream sandwich and greater, where minSDK is 14) and styles-v16
(so on so forth if you need the styles to be applied when available)
Now when the style needs a higher SDK version, place it in respective style resource directory. textAllCaps goes into styles-v14, android:fontFamily goes into styles-v16.
More can be found here on resource qualifiers ;) http://developer.android.com/guide/topics/resources/providing-resources.html
Hope this helps buddy, happy coding!
Upvotes: 1