Mohd Hafiz
Mohd Hafiz

Reputation: 167

Error:Could not find com.android.tools.build:gradle:3.0.0-beta2

I having problem to compile new gradle as shown below here :

Error:Could not find com.android.tools.build:gradle:3.0.0-beta2. Searched in the following locations: file:/C:/Program Files/Android/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom file:/C:/Program Files/Android/android-studio-preview/gradle/m2repository/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-beta2/gradle-3.0.0-beta2.jar Required by: project : Open File

This is my gradle :

buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
    jcenter()
}
dependencies {
    classpath "com.android.tools.build:gradle:3.0.0-beta2"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

Upvotes: 3

Views: 3227

Answers (2)

Aayushi
Aayushi

Reputation: 1816

I resolved it by adding depemdency in this manner-

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-beta4' 

}

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

You have to add the gradle maven repo:

 maven { url 'https://maven.google.com' }

Something like:

buildscript {
    //..
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
    //..
}

You can also use the google() shortcut if you are using Android Studio 3.x and gradle v.4

buildscript {
    repositories {
        ...
        // You need to add the following repository to download the
        // new plugin.
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-beta-2'
    }
}

Upvotes: 8

Related Questions