This is a phonegap 3.5 / cordova 3 android app. In www/config.xml I have:
STEP 1) yourapp/config.xml file <platform name="android">
tags add two preference
<platform name="android">
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="19" />
</platform>
STEP 2) cordova platform rm android
run cmd code
STEP 3) cordova platform add android
run cmd code
Check your AndroidManifest.xml file if look like below
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
every thing is OKAY :)
I was able to fix this by manually editing platforms/android/AndroidManifest.xml:
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
The Phonegap documentation seems to imply that this file should inherit the value of the android-minSdkVersion preference, but it must be changed manually. The android-minSdkVersion preference doesn't seem to do anything as far as I can tell.
Edit and improved answer:
To answer this, it's better to begin with Build version, or API Level. API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.
API Level 8 == android Platform 2.3(ginger bread)
API Level 17 == android Platform 4.2(jelly bean)
To see complete comparison of APILevel and its AndroidPlatform check here
targetSdk is to be used by phonegap only. This tell phonegap to use certain APILevel to build this app. This does not meant to limit any user from downloading your app. It is more like to say, "The app is optimized for this APILevel". example
<preference name="android-targetSdkVersion" value="17"/> //android 4.2
This app is build(optimised) using APILevel 17 (which is jellyBean or androidPlatform4.2)
minSdk on the other hand, limit the user/device. minSdk is the minimum requirement of Sdk for user/device. Any device with APIlevel less than APILevel used by minSdk, won't be able to download this app. example:
<preference name="android-minSdkVersion" value="11"/> //android 3.0
to download this app, the device has to at least run on android 3.0 (APILevel 11)
Finally, when used together:
<preference name="android-minSdkVersion" value="11"/> //android 3.0
<preference name="android-targetSdkVersion" value="17"/> //android 4.2
This statement means that this app is optimized for android4.2, with minimum requirement of android 3.0
Doc: http://docs.build.phonegap.com/en_US/configuring_preferences.md.html#Preferences
For anyone getting here looking for a way to set a specific target version, I found this: I just had the same problem. I had to change the target:
target=android-22 This should be done in two files:
myApp/platforms/android/project.properties myApp/platforms/android/CordovaLib/project.properties
Also the manifest should be updated:
From Sebastian answer placed here: Cordova : [Error: Please install Android target: "android-21"
With older version of cordova CLI, I used to modify manually AndroidManifest.xml
to change a few settings (launch mode, minsdk...) like you do in your answer.
And with Cordova 3.5.something things started to go wrong, and some changes were lost each time I built the project.
Now I added those lines in config.xml
and the settings are updated automatically :
<platform name="android">
<preference name="AndroidLaunchMode" value="singleTop"/>
<preference name="android-minSdkVersion" value="14" />
<icon src="res/android/xhdpi.png" />
<icon src="res/android/ldpi.png" density="ldpi" />
<icon src="res/android/mdpi.png" density="mdpi" />
<icon src="res/android/hdpi.png" density="hdpi" />
<icon src="res/android/xhdpi.png" density="xhdpi" />
</platform>
The advantage is that I can now delete the android platform and recreate it without loosing any setting.
As Phonegap is being updated to be inline with cordova, preferences in config.xml
should work with the new version, and maybe you will see your manual updated be lost like it happened to me...
I fixed this issue by building with Android Studio instead of using Cordova CLI to build.