How do I specify the Android API Level in PhoneGap?

You shouldn't edit AndroidManifest.xml. You can/should do it cordova config.xml file in preference:

<preference name="android-targetSdkVersion" value="14" />
<preference name="android-minSdkVersion" value="14" />

For Android 6.0 (API 23) , Android version is specified in project.properties file. It is placed just close AndroidManifest.xml in ProjectDir/platforms/android directory. If it can help.


Please do not modify AndroidManifest.xml in your platforms directory. With current cordova/phonegap version, this should not be necessary anymore (you can ignore platforms from version control!).

Instead set:

<preference name="android-minSdkVersion" value="14" />

All possible configs are available here: http://docs.build.phonegap.com/en_US/2.9.0/configuring_basics.md.html (the document says, it works for phonegap build, but it works the same for cordova/phonegap cli!).

EDIT: New Link http://docs.phonegap.com/phonegap-build/configuring/preferences/#android-minSdkVersion


The way I handle platform customizations is to create a separate directory called config with this structure:

   config
       android
           AndroidManifest.xml
           images
       ios
           images

Then I write a hook to copy the files from config to platforms/android/... (either after_prepare or after_platform_add depending on how often I want to copy over the files).

That way you can modify AndroidManifest.xml and still keep the platforms directory totally under control of Cordova CLI.

Tags:

Cordova