Couldn't find com.android.tools.build:gradle:3.0.0

Bitrise Build Issue Report template

After updating Android project to using gradle 3.0.0 project stopped building with success. Locally everything works properly.

Environment:

Stack used: Android & Docker, on Ubuntu 16.04
Problem occures on step: install-missing-android-tools@2.0.4

Reproducibility

  • Does a ā€œRebuildā€ help? (You can trigger a rebuild from the Buildā€™s page, by clicking the ā€œRebuildā€ button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • If you have multiple different build configurations (workflows), does the issue affect all/more than one? : YES (all)
  • If itā€™s an issue which happens sporadically, whatā€™s the frequency? (e.g. Once a day ; about x% of the builds) : NO (reproducibility 10/10)
  • Does upgrading the build Step to the latest version help? : YES

Build log

Ā±-----------------------------------------------------------------------------+

| (3) install-missing-android-tools@2.0.4 |
Ā±-----------------------------------------------------------------------------+
| id: install-missing-android-tools |
| version: 2.0.4 |
| collection: GitHub - bitrise-io/bitrise-steplib: New Bitrise StepLib |
| toolkit: go |
| time: 2017-10-31T15:12:40Z |
Ā±-----------------------------------------------------------------------------+
| |
Configs:

  • RootBuildGradleFile: build.gradle
  • GradlewPath: ./gradlew
  • AndroidHome: /opt/android-sdk-linux
    Preparation
    Set executable permission for gradlew
    Initialize Android SDK
    Ensure android licences
    Ensure required Android SDK components
    Searching for missing SDK components using:
    $ ./gradlew ā€œdependenciesā€
    Failed to find missing components, retryingā€¦
    Searching for missing SDK components using:
    $ ./gradlew ā€œdependenciesā€
    Failed to find missing components, retryingā€¦
    Searching for missing SDK components using:
    $ ./gradlew ā€œdependenciesā€
    Parallel execution is an incubating feature.
    FAILURE: Build failed with an exception.
  • What went wrong:
    A problem occurred configuring root project ā€˜srcā€™.

Could not resolve all files for configuration ā€˜:classpathā€™.
Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project :
Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project : > io.realm:realm-gradle-plugin:3.0.0
project : > io.realm:realm-gradle-plugin:3.0.0 > io.realm:realm-transformer:3.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  • Get more help at https://help.gradle.org
    BUILD FAILED in 1s
    exit status 1
    | |
    Ā±ā€“Ā±--------------------------------------------------------------Ā±---------+
    | x | install-missing-android-tools@2.0.4 (exit code: 1) | 46 sec |
    Ā±ā€“Ā±--------------------------------------------------------------Ā±---------+
    | Issue tracker: ā€¦bitrise-steplib/steps-install-missing-android-tools/issues |
    | Source: ā€¦://github.com/bitrise-steplib/steps-install-missing-android-tools |
    Ā±ā€“Ā±--------------------------------------------------------------Ā±---------+

Hi @GSA,

Thanks for filling out the report! :slight_smile:

What the issue is

Could not find com.android.tools.build:gradle:3.0.0.

This error comes from Gradle, not from Bitrise.

In your project you have a reference to this dependency/plugin (or in general might be a dependency of a dependency).

If you check the links gradle prints in the error (Searched in the following locations) those indeed are 404 / not found pages.

Why it works locally

Because most likely at one time this dependency version was available, and so itā€™s now available on your Mac/PC in the filesystem (cache), and Gradle wonā€™t try to download it (as itā€™s already downloaded). But then the version was removed / is no longer available, so it will no longer work on any new Mac/PC (as the dependency version canā€™t be downloaded).

How to debug & fix

In case of an Android ā€œCould not find ā€¦ā€ issue itā€™s usually enough to just:

  1. Do a clean git clone of the repository, into a new directory
  2. And try to build the project from there

That should make it so that thereā€™s no local dependency cache, and all dependencies will be downloaded (and the ones not available anymore will fail).

Once you can reproduce the issue, you can simply debug and fix it on your Mac/PC and then commit the changes, and itā€™ll work on Bitrise.io too. In this specific case you most likely just have to upgrade the version of the plugin/dependency to a version which still exists.

For more debugging options & more infos / guides for local debugging please see:

and


If you have any questions just let us know! :wink:

Another thing for the Gradle Android plugin v3 migration: as described in the official migration guide (Ų¶ŲØŲ· Ų§Ł„Ų„ŲµŲÆŲ§Ų±  |  Android Studio  |  Android Developers), please make sure that you add google() to the repositories list in build.gradle!

In fact youā€™ll most likely need both google() and jcenter() right now:

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.

Iā€™m also facing the same issue. Above solution didnā€™t work out for me. Am I missing any thing here?

FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project ā€˜srcā€™.
Could not resolve all files for configuration ā€˜:classpathā€™.
Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
Required by:
project :

i just add ā€œgoogle()ā€ code into my build.gradle. and it worked for meā€¦ Thanks

buildscript {
    repositories {
        google() // add this code
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}
2 Likes

@amitks17 did you add google() to repositories in build.gradle? Like @qasir mentioned above :point_up: as well as I mentioned here Couldn't find com.android.tools.build:gradle:3.0.0

Sorry it was my mistake. I had added google() to allprojects { repositories {}} instead of buildscript { repositories{}}. Itā€™s working after the correction.
Thanks.

1 Like

Glad to hear it worked! :tada: :slight_smile:

Please, i have the same exact issue, the only difference, my problem is i canā€™t download these dependencies for some reason, i am behind proxy and i tried set http(s)_proxy but doesnā€™t do anything. So iā€™m not even sur where the problem comes from. i tried a differnrt connexion with no proxy (but slower), it takes several minutes before giving the same error
If any one have any idea, iā€™m stuck since a week, i read everything on the internet .:sob::sob: