Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap Create and Build commands fail due to minSDK version

Tags:

gradle

cordova

When I try to create a phonegap project with the following command ;

 phonegap create myapp --id com.apps.myapp  --name myapp

I get the following error ;

Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller version        
10 declared in library     projectName\platforms\android\ build\  intermediates\exploded\aar\android\cordovaLib\unspecified\debug\AndroidManifest.xml .  
Suggestion : use     
tools.overrideLibrary = "org.apache.cordova" to force usage. 

I used to work with such commands fine but something happened right after I installed Android Studio (with Gradle) and upgraded cordova version to 5.0.0-0-27.1. Is there any way of getting rid of this Gradle ? I think because of Gradle and its configuration , phonegap create command started to work in a different way.

Or Gradle has always been there and something else is messing up my configuration. If not, please help me remove everything about Gradle and work properly.

After all (if removing Gradle does not make sense), how am I going to specify the minSDK version by the command line while I create the project ? .

like image 565
shamaleyte Avatar asked May 04 '15 18:05

shamaleyte


2 Answers

The solution is add the line:

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

in your config.xml

See: Where to change minSdkVersion setting in PhoneGap app

like image 57
Javier Avatar answered Oct 18 '22 19:10

Javier


Not sure why the latest version caused to such problem but, when I get the cordova and phonegap version back to 3.x versions, the problem disappeared.

To check the versions available;

npm view phonegap versions

To uninstall the current version

npm uninstall -g phonegap

To install a specific prev. version

npm install -g [email protected]

You can use the same commands for cordova framework as well.

Alternate solution without needing to install older versions ! (If you had a phonegap project before and you end up having problems after upgrading your framework versions)

Install the latest versions of both Cordova and Phonegap, then create your project with the following command ;

cordova create projectName  com.example.projectName projectName

Then copy the .cordova folder from one of the projects that you created before, and for what you used to run "phonegap build" command with no error. Then paste it into your new project's main path where www folder is also located.

Here you go, now you are able to run phonegap commands without build failure.

like image 1
shamaleyte Avatar answered Oct 18 '22 20:10

shamaleyte