[android] Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci

I update the gradle plugin to the latest : com.android.tools.build:gradle:3.0.0-alpha1 and this error occured :

export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew test;else gradle test;fi

FAILURE: Build failed with an exception.

What went wrong:
    A problem occurred configuring root project 'Android-app'. Could not
 resolve all dependencies for configuration ':classpath'. Could not
 find com.android.tools.build:gradle:3.0.0-alpha1. Searched in the
 following locations:
 https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
 https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
 Required by:

Current circle.yml

dependencies:
   pre:
      - mkdir -p $ANDROID_HOME"/licenses"
      - echo $ANDROID_SDK_LICENSE > $ANDROID_HOME"/licenses/android-sdk-license"
      - source environmentSetup.sh && get_android_sdk_25

   cache_directories:
    - /usr/local/android-sdk-linux
    - ~/.android
    - ~/.gradle
   override:
    - ./gradlew dependencies || true

test:
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

machine:
    java:
        version: oraclejdk8

Edit: My gradle file :

buildscript {
  repositories {
    jcenter()
    maven {
      url 'https://maven.google.com'
    }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
    classpath 'com.google.gms:google-services:3.0.0'
    classpath "io.realm:realm-gradle-plugin:3.1.3"
  }
}

allprojects {
  repositories {
    mavenCentral()
    jcenter()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

This question is related to android android-studio gradle build circleci

The answer is


For Iranian people: We need use proxy or VPN to building app.

Reason: The boycott by Google's servers causes that you can't build app or upgrade your requirement.


My problem was that I forgot that I added a proxy in gradle.properties in C:\Users\(current user)\.gradle like:

systemProp.http.proxyHost=****
systemProp.http.proxyPort=8850

Update: Incredibly frustrating, but the Google redirect of the maven.google.com repo seems to mess with loading the resources. If you instead set your repository to maven { url 'https://dl.google.com/dl/android/maven2' } the files will resolve. You can prove this out by attempting to get the fully qualified resource at https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom 3.0.0 Alpha

This is because currently the gradle:3.0.0-alpha1 is only being served via the new 'https://maven.google.com' repository, but the site currently 404s at that location otherwise, being a public directory, you'd see a tree listing of all the files available by simply navigating to that location in your browser. When they resolve their outage, your CI build should pass immediately.


For things to compile via command line I needed to include the maven repo in BOTH buildscript and allprojects.

root build.gradle:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
        ...
    }
}

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

It's needed in the buildscript block to find the AGP, and in allprojects block to find android.arch and com.android.databinding packages (and others)

UPDATE: It looks like the new repo is just called google() but I still needed to declare it in both places.


I have this problem when update android studio from 3.2 to 3.3 and test every answers that i none of them was working. at the end i enabled Maven repository and its work.

enter image description here


Make sure you add following line in your top level build.gradle and that should fix it.

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

I got exact same error you mentioned above, once I added this entry everything worked.


Android Studio (Preview) sometimes recommends updating to a Gradle Plugin that is not available yet (did Google forget to publish it?). Such as today with

'com.android.tools.build:gradle:3.1.0-beta1'

I found I can see current versions of com.android.tools.build:gradle here, and then I just pick the newest:

https://dl.google.com/dl/android/maven2/index.html

I just found this beta1 gradle bug in the Android Bug Tracker. I also just learned Android Studio > Help Menu > Submit Feedback brought me to the bug tracker.

Found temporary solution at androiddev reddit for the 3.1.0-beta1 problem: Either roll back to Preview Canary 8, or switch to gradle plugin 3.0.1 until Canary 10 is released shortly.


I find this at google: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

It mentiones that we need to

  1. Update Gradle version to gradle-4.1-all ( changegradle-wrapper.properties by distributionUrl=\https\://services.gradle.org/distributions/gradle-4.1-all.zip
  2. Add google() to repositories repositories { google() } and dependencies { classpath 'com.android.tools.build:gradle:3.0.0-beta7' }

You may require to have Android Studio 3


I did this:

click SDk Manager:

enter image description here

Change in updates to Canary Channel, check and update it...

enter image description here

After go in build.gradle and change the compile version to 26.0.0-beta2:

enter image description here

After go in gradle/build.gradle and change dependencies classpath 'com.android.tools.build:gradle:3.0.0-alpha7':

enter image description here

After sync the project... It works to me! I hope I've helped... tks!


mtrakal's solution worked fine.

Added to gradle.build:

buildscript {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha2'

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

allprojects {
    repositories {
        jcenter()
    }
}

Then it automatically upgraded to alpha2.

Invalidate the caches and restarted all is fine.

File | Invalidate Caches / Restart

choose 'Invalidate & Restart'


For me I solved this error just by adding this line inside repository

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

To synchronize all of the answers here and elsewhere:

buildscript {
  repositories {
    google() 
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'

  } }

Make your buildscript in build.gradle look like this. It finds all of them between google and jcenter. Only one of them will not find all of the dependencies as of this answer.


Just add this

buildscript {
    repositories {
        ...
        google() 
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0' 
    }
}

It works...Cheers!!!


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to build

error: This is probably not a problem with npm. There is likely additional logging output above Module not found: Error: Can't resolve 'core-js/es6' WARNING in budgets, maximum exceeded for initial How can I change the app display name build with Flutter? Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0) Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation' Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details Component is part of the declaration of 2 modules Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven

Examples related to circleci

Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci