Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Android Studio Gradle plugin to last version

I'm new to Android developpement and I tried to install the Facebook SDK in my Android Studio project.

Then, I have a bug in build.gradle :

Error:(111, 0) Cannot call getBootClasspath() before setTargetInfo() is called.

So I searched for a solution and I found this on the stack:

This is a known issue , which is fixed by updating gradle to :

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

So I tried this but then I got the error:

Error:Could not find com.android.tools.build:gradle:1.1.2.
Searched in the following locations:
file:/home/roman/Documents/softs/android-studio/gradle/m2repository/com/android/tools/build/gradle/1.1.2/gradle-1.1.2.pom
file:/home/roman/Documents/softs/android-studio/gradle/m2repository/com/android/tools/build/gradle/1.1.2/gradle-1.1.2.jar
Required by:
Yoki:facebook:unspecified

So I moved into the specified directory and then there is only this:

$>  ls  
1.0.0  1.1.0
$>  pwd
/home/roman/Documents/softs/android-studio/gradle/m2repository/com/android/tools/build/gradle

How can I update the gradle plugin?

like image 245
Jidey Avatar asked Apr 17 '15 14:04

Jidey


2 Answers

Change your buildscript block. You have to specify also in this block the repositories.

buildscript {
    repositories {
        mavenCentral()
    }

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

Also you can use the last version:

        classpath 'com.android.tools.build:gradle:1.1.3'
like image 131
Gabriele Mariotti Avatar answered Oct 21 '22 19:10

Gabriele Mariotti


There are three type of dependency in Android gradle file.

1. Module dependency: other local project.

2. Local dependency: in your sdk path extras folder.

3. Remote dependency: JCenter, MavenCenter or third party maven path.

'com.android.tools.build:gradle' is local dependency, so you have to check your sdk and update.

P.S. If you tired with the version issue, you can try andle.

It's an open source project to update your Android dependency version automatically.

See https://github.com/Jintin/andle for more information

like image 44
Jintin Avatar answered Oct 21 '22 20:10

Jintin