Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Get Cordova to Work With Android Studio?

I have the newest everything, node, npm, android studio, cordova.

I created a new project with:

cordova create test
cd test
cordova platform add android

I go into Android Studio, import project, go to test/platforms/android it finds the build.gradle file, works on it for awhile then spits out:

Gradle version 1.10 is required. Current version is 2.2.1

So I go to my build.gradle file, and update the line

dependencies {
        classpath 'com.android.tools.build:gradle:0.10.+'
    }

to:

 dependencies {
        classpath 'com.android.tools.build:gradle:0.14.+'
    }

And then I re-import my project, it chugs on it for awhile, then spits out:

Error:failed to find Build Tools revision 19.0.0

So I install Build Tools 19.0.0

And it tells me:

Error:The SDK Build Tools revision (19.0.0) is too low for project 'android'. Minimum required is 19.1.0

So I look at my SDK Manager and I have 19.1.0 installed

So I go back into my build.gradle file:

and I change:

buildToolsVersion "19.0.0"

to

buildToolsVersion "19.1.0"

And re-import again,

And still tells me: Error:The SDK Build Tools revision (19.0.0) is too low for project ':CordovaLib'. Minimum required is 19.1.0

I even try and delete SDK Build Tools revision 19, and keep 19.1 but it still tells me that.

Can anyone that has done this song and dance please help me?

like image 976
Shai UI Avatar asked Dec 19 '14 07:12

Shai UI


2 Answers

I had exactly the same problem and just fixed it. What you need to do is complete the same buildToolsVersion "19.1.0" change to the build.gradle file in the CordovaLib folder within your platform project folder e.g. platforms/android/CordovaLib.

like image 89
Michael Szabo Avatar answered Oct 19 '22 08:10

Michael Szabo


I solved the problem, modifing gradle file App and gradle file CordovaLib, with the following information:

changed   dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0+'
    }
}

and

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"
}

Tested on Android Studio 1.1

like image 25
Mael Avatar answered Oct 19 '22 07:10

Mael