How can I specify the minimum SDK in phonegap? It is ignoring android-minsdkversion in config.xml

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="https://stackoverflow.com/questions/27135185/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="https://stackoverflow.com/questions/27135185/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…

Leave a Comment