'Bitrise: Could not resolve all artifacts for configuration ':classpath' Could not resolve com.google.gms:google-services:4.2.0

After updating com.android.tools.build:gradle and com.google.gms:google-services I can build project local (command gradlew build --scan) but in Bitrise I get BUILD FAILED and message:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'git'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:4.1.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:4.1.0.
> Could not get resource 
'http://dl.bintray.com/populov/maven/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'.
> Could not GET 
'http://dl.bintray.com/populov/maven/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom'. 
Received status code 502 from server: Bad Gateway
> Could not resolve com.google.gms:google-services:4.2.0.
Required by:
project :
> Could not resolve com.google.gms:google-services:4.2.0.
> Could not get resource 'http://dl.bintray.com/populov/maven/com/google/gms/google- 
services/4.2.0/google-services-4.2.0.pom'.
> Could not GET 'http://dl.bintray.com/populov/maven/com/google/gms/google- 
services/4.2.0/google-services-4.2.0.pom'. Received status code 502 from server: Bad Gateway
> Could not resolve io.fabric.tools:gradle:1.28.0.

I've tried every recommendations what I found, but I still get this message.

My build.gradle file

buildscript {
repositories {
    maven { url "http://dl.bintray.com/populov/maven" }
    google()
    mavenCentral()
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    maven { url 'https://dl.bintray.com/android/android-tools' }
    maven { url 'https://maven.fabric.io/public' }
    maven {
        url 'https://google.bintray.com/exoplayer/'
    }
}

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath 'com.google.gms:google-services:4.2.0'
    classpath 'io.fabric.tools:gradle:1.28.0'
    classpath "me.tatarka:gradle-retrolambda:3.7.1'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}
allprojects {
repositories {
    maven { url "http://dl.bintray.com/populov/maven" }
    mavenCentral()
    jcenter()
    maven {
        url "https://maven.google.com/"
        name 'Google'
    }
    maven { url "https://dl.bintray.com/android/android-tools" }
    maven { url "https://maven.fabric.io/public" }
    maven {
        url "https://google.bintray.com/exoplayer/"
    }
}
}

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME


Solution 1:[1]

Seems like jcenter is currently down. (see https://jcenter.bintray.com/)

You can wait for jcenter to be up or migrate to use something else: https://developer.android.com/studio/build/jcenter-migration

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gkueny