Error:(6, 0) Gradle DSL method not found: 'google()' Error:(6, 0) Gradle DSL method not found: 'google()' android android

Error:(6, 0) Gradle DSL method not found: 'google()'


The google() repo is a shortcut to look in Google's Maven repository for dependencies. It was introduced with gradle v.4.0.

It requires (currently)

  • Gradle v.4
  • Android Studio 3.x.
  • Gradle plugin for Android 3.x

Try to use in gradle-wrapper.properties use:

distributionUrl=\  https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip

As gradle plugin for Android use:

classpath 'com.android.tools.build:gradle:3.0.0-beta1'

In any case (also with Android Studio 2.3, gradle plugin 2.3.3 and gradle v3.3) you can use the same maven repo using { url 'https://maven.google.com'}. It is the same.

Just use for example:

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


If you use Android studio 2.3.3, then try adding this in your project level gradle

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

this worked for me.

You also can use google() instead but you need Gradle 4.x+, Android Studio 3.x+ , Gradle plugin 3.x+


Just change gradle-wrapper.properties file (below image)

gradle-wrapper.properties

To this (if your gradle is com.android.tools.build:gradle:3.0.1)

distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // this version or above|

For gradle

com.android.tools.build:gradle:3.2.1

Use this

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

UPDATE

For following gradles

//# 1com.android.tools.build:gradle:3.0.1 //# 2com.android.tools.build:gradle:3.1.0 //# 3com.android.tools.build:gradle:3.2.1 //or 3.2.0 //# 4com.android.tools.build:gradle:3.3.2 //or 3.3.0 //# 5com.android.tools.build:gradle:3.4.0 //# 6com.android.tools.build:gradle:3.5.0 //# 7com.android.tools.build:gradle:4.0.1

Use following urls

//# 1distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip//# 2distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip//# 3distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip //# 4distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip//# 5distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip//# 6distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip//# 7distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Don't forget adding google() in buildscript repositories.