Apollo-android: Could not find com.android.tools.build:gradle:3.2.1. after upgrading to Android Studio 3.3

Created on 16 Jan 2019  路  5Comments  路  Source: apollographql/apollo-android

I am getting following error after updating AS to 3.3.

ERROR: Could not find com.android.tools.build:gradle:3.2.1.
Searched in the following locations:
  - file:/home/cube/Development/android-studio/gradle/m2repository/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
  - file:/home/cube/Development/android-studio/gradle/m2repository/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
  - https://dl.bintray.com/android/android-tools/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
  - https://dl.bintray.com/android/android-tools/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
  - https://maven.fabric.io/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
  - https://maven.fabric.io/public/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
  - https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom
  - https://jcenter.bintray.com/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.jar
Required by:
    project :app > com.apollographql.apollo:apollo-gradle-plugin:1.0.0-alpha4
Open File

My main gradle file is:

buildscript {
    ext.kotlin_version = '1.3.11'
    repositories {
        maven { url "https://dl.bintray.com/android/android-tools" }
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        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
        classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
    }
}

the app gradle file is:

buildscript {
    repositories {

        /*maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
*/
        maven { url "https://dl.bintray.com/android/android-tools" }
        maven {
            url 'https://maven.fabric.io/public'
        }
        jcenter()

    }
    dependencies {
        classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.0.0-alpha4'

        // Add dependency
        classpath 'io.fabric.tools:gradle:1.27.0'
    }
}

repositories {
    jcenter()
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}

Most helpful comment

Try adding google repository in your app gradle file

buildscript {
    repositories {
         ...
         google()
    }

All 5 comments

Try adding google repository in your app gradle file

buildscript {
    repositories {
         ...
         google()
    }

clear gradle cache

rm -rf $HOME/.gradle/caches/
and resync to download all dependencies

Go Settings/Gradle/Android Studio. Then check "Enable embedded Maven repository". And you're good to go.

It was updated to 3.3.0

you need to go to build gradle and tape like this:
google()
and this option do it in the build script & allproject

Make sure there is:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
in gradle-wrapper.properties
and then:
buildscript {
repositories {
...
google()
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmrandom picture gmrandom  路  4Comments

jamesweb1 picture jamesweb1  路  3Comments

john-lanticse picture john-lanticse  路  3Comments

AOrobator picture AOrobator  路  3Comments

romainpiel picture romainpiel  路  4Comments