Rob
Rob

Reputation: 4234

ERROR: Could not find com.android.tools.build:gradle:3.4.1

I am trying to update my Android project.

I initially got this error:

ERROR: Gradle DSL method not found: 'classpath()' Possible causes: The project 'xxx' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). Upgrade plugin to version 3.4.1 and sync project

So I tried this in my app's build.gradle:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'io.fabric.tools:gradle:1.29.0'
    }
}

But now I'm getting this error:

ERROR: Could not find com.android.tools.build:gradle:3.4.1.

What to do? Thanks for your help.

Upvotes: 4

Views: 7418

Answers (2)

no_cola
no_cola

Reputation: 1160

buildscript {
    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
    }
}

Upvotes: 3

ismail alaoui
ismail alaoui

Reputation: 6063

It seems the current versions of the Android Gradle plugin are not added to Maven Central, but they are present on jcenter. Add jcenter() to your list of repositories and Gradle should find version

repositories {
    ....
    jcenter()
    ...
}

Upvotes: 2

Related Questions