Two <uses-sdk> being added in AndroidManifest.xml


#1

Whenever I run “ionic platform add android” - I end up with two uses-sdk entries in my android manifest xml file. I don’t recall this happening until after I updated to Cordova 5.2.0. Has anyone else seen this? I always get a second entry under my intended entry for Android SDK 19.

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />

Edit: Someone is also having this problem and filed a ticket on GitHub https://github.com/driftyco/ionic-cli/issues/549
No resolution yet it seems


#2

This extra line in the AndroidManifest.xml is indeed preventing ionic to run on lower API level devices.

As suggested in the github link above, I had to

  • modify the /plugins/android.json file and remove the following section:

{
“xml”: “< uses-sdk android:minSdkVersion=“19” android:targetSdkVersion=“19” >”,
“count”: 1
},

  • Modify /platforms/android/AndroidManifest.xml and remove the extra “uses-sdk” tag

< uses-sdk android:minSdkVersion=“19” android:targetSdkVersion=“19” />

I am able to get my app running on the min/target SDK devices after this modification, but am hoping for cleaner solution because we might have to do this every time when we rebuild the android platform.