Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova build --release android always picks the highest api level

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.

like image 790
Dinesh Avatar asked May 12 '15 23:05

Dinesh


People also ask

Which of the following version of Java is recommended for Cordova app?

Java Development Kit (JDK) If you are using cordova-android 10.0. 0 or greater, install the Java Development Kit (JDK) 11. If you are using any version below cordova-android 10.0. 0, install the Java Development Kit (JDK) 8.

What is Android Cordova?

Cordova Android is an Android application library that allows for Cordova-based projects to be built for the Android Platform. Cordova based applications are, at the core, applications written with web technology: HTML, CSS and JavaScript. Apache Cordova is a project of The Apache Software Foundation (ASF).


2 Answers

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

like image 114
Mr Megamind Avatar answered Oct 11 '22 17:10

Mr Megamind


npm install -g cordova 

above command always install latest cordova-android-version and so android-target is latest. So we can solve the above problem by installing appropriate cordova version.

you can install appropriate version of cordova using this command npm install -g [email protected] where 5.0.0 is cordova-android-version.all version of cordova can be viewed using following command.

npm view cordova versions

4.1.X(cordova-android Version) supports 14-22 (API level) and

5.X.X(cordova-android Version) supports 14-23 (API level)

like image 39
Mahen Avatar answered Oct 11 '22 17:10

Mahen