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

#1

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: https://github.com/bitrise-io/bitrise-steplib.git |
| 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 |
    ±–±--------------------------------------------------------------±---------+
0 Likes

#2

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:

0 Likes

#3

Another thing for the Gradle Android plugin v3 migration: as described in the official migration guide (https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html), 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.

0 Likes

#4

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 :

0 Likes

#5

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

#6

@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

0 Likes

#7

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

#8

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

0 Likes

#9

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:

0 Likes