I am trying to build my cordova app for android, using ionicframework. I have set my target API level to 16 (I have that installed from Android SDK manager) but it somehow always picks up level 21.
in project/config.xml:
<preference name="android-targetSdkVersion" value="16"/>
in platforms/android/AndroidManifest.xml, it shows the same:
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
but running cordova build --release android
I get:
-build-setup:
[getbuildtools] Using latest Build Tools: 22.0.0
[echo] Resolving Build Target for OpsVedaMobile...
[gettarget] Project Target: Android 5.0.1
[gettarget] API level: 21
I suspect I am missing some more settings, will appreciate help. I used the how-to from this ionic doc
ionic: 1.0.0.rc-5, ionic CLI: 1.3.22, cordova: 5.0.0, node: 0.10.36 - on Windows7
--EDIT
it appears that the target level didn't matter at all. I now wonder how/where does it become significant.
in latest ionic framework you can change the target by changing
ion1/platforms/android/AndroidManifest.xml
and change the 22 into these two files with 16
ion1/platforms/android/project.properties
ion1/platforms/android/CordovaLib/project.properties
ion1 = my project base folder
So this bit of xml does two things, sets the minimum api version for the android app, and sets the target, obviously because of their name.
So api 10 is android 2.3, which we've dropped support for. So we can bump that to 14, or android 4.0
Api 19 is 4.4 which is all good.
So these number are part of the default project structure that cordova makes. You could create a hook that after the project is add, it changes the default api level to 14 and 19 instead of manually doing it.
But to change it, go to platforms/android/android.xml, if you edit this, you should be good. (or) Before change:
] android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib"
I changed this to:
] android update project --subprojects --path "platforms/android" --target android-14 --library "CordovaLib"
And then modified the AndroidManifest.xml file as you suggested, now all the debug states level 14 and it compiled. I just sent a copy over to my buddy again.. we'll see if it works!
You can set it manually to 16
Users > MNurdin > .cordova > lib > android > cordova > 3.X.X > framework
Open project.properties
and change target=android-XX
to 16
.