Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

This is a phonegap 3.5 / cordova 3 android app. In www/config.xml I have:

<preference name="android-minSdkVersion" value="19"> <preference name="android-targetSdkVersion" value="19"> 

However, when I build it, it creates an AndroidManifest.xml with:

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

The result is that people with SDK versions below 19 can install my app from the store. Where is it getting that 10 from and how can I change it? Due to weirdness with Viewport, my app's behavior is suspect on OSes below 4.4 and I am already getting 1-star reviews from 4.2.2 users.

like image 892
DevOfZot Avatar asked Nov 25 '14 19:11

DevOfZot


People also ask

What is the minimum android SDK version?

The Android app must have a minimum SDK version 19 or higher.

What is the meaning of the minimum SDK version for an app?

The min sdk version is the earliest release of the Android SDK that your application can run on. Usually this is because of a problem with the earlier APIs, lacking functionality, or some other behavioural issue. The target sdk version is the version your application was targeted to run on.

What is Cordova Android?

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

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...

like image 126
QuickFix Avatar answered Oct 07 '22 01:10

QuickFix


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 :)

like image 33
Ferhat KOÇER Avatar answered Oct 07 '22 00:10

Ferhat KOÇER