Search code examples
androidgradleandroid-gradle-plugingradlew

Upgrade to Gradle 6 & Android Gradle Plugin 4.0.0 fails to fetch "https://dl.google.com/android/repository/addons_list-3.xml"


I have CI configured for my Android project.

The server in which the project is built has no access Internet access. So, I get this error:

 IOException: https://dl.google.com/android/repository/addons_list-3.xml
 java.net.ConnectException: Connection timed out (Connection timed out)

All the repositories in the project build.gradle file are declared like this:

repositories {
    maven("https://artifactory.mycompany.com/artifactory/jfrog-gradle-plugins")
    maven("https://artifactory.mycompany.com/artifactory/maven-fabric")
    maven("https://artifactory.mycompany.com/artifactory/remote-repos")
    maven("https://artifactory.mycompany.com/artifactory/google-maven")
    maven("https://artifactory.mycompany.com/artifactory/jcenter")
    maven("https://artifactory.mycompany.com/artifactory/libs-android")
}

This error started when I upgraded the Gradle Wrapper to 6.1.1 and the Android Gradle Plugin 4.0.0.

The main change was the one that's described in here:

https://docs.gradle.org/6.0/userguide/declaring_repositories.html#sec:supported_metadata_sources

..that is, I added these options to my repositories since I have artifacts/libraries without a pom.xml file.

    metadataSources {
        mavenPom()
        artifact()
    }

So, I think the changes above make the Gradle Plugin to try to download something from

https://dl.google.com/android/repository/addons_list-3.xml

but I can't confirm that's the cause.


Solution

  • Turns out the build machine used by my CI setup was configured with the build tools version 29.0.0, then latest Android Gradle Plugin (4.0.0) was trying to download the latest android build tools (29.0.2).

    Once I updated the android build tools in the build machine, everything worked fine.