Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

gradle

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.

like image 245
Rob Avatar asked Sep 13 '25 00:09

Rob


2 Answers

buildscript {
    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
    }
}
like image 108
no_cola Avatar answered Sep 14 '25 19:09

no_cola


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()
    ...
}
like image 26
ismail alaoui Avatar answered Sep 14 '25 19:09

ismail alaoui