30

Per JFrog, they are sunsetting Bintray (which includes JCenter) on May 1st, 2021.

To prep for this, I opened my build.gradle and replaced jcenter() with mavenCentral(). My build.gradle now looks like this (with some parts removed):

buildscript {
    repositories {
        google()
        // jcenter()
        mavenCentral()
    }

    dependencies {
        // ...
    }
}

allprojects {
    repositories {
        google()
        // jcenter()
        mavenCentral()

        maven {
            url "https://jitpack.io"
        }
    }
}

However, since replacing jcenter() with mavenCentral(), I receive this error:

A problem occurred configuring root project 'Redacted'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find org.jetbrains.trove4j:trove4j:20160824.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
     Required by:
         project : > com.android.tools.build:gradle:4.1.2 > com.android.tools.build:builder:4.1.2 > com.android.tools:sdk-common:27.1.2

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Is there another repository I can add to resolve this, or does com.android.tools:sdk-common need to update to use a different version of org.jetbrains.trove4j:trove4j?

Update: Version 4.1.3 still has the same issue.

Westy92
  • 19,087
  • 4
  • 72
  • 54

2 Answers2

27

JetBrains copied org.jetbrains.trove4j:trove4j:20160824 to Maven Central, which resolves this error.

If you use additional dependencies that have not yet migrated to Maven Central, you should reach out directly to them.


Update: "We listened to the community and will keep JCenter as a read-only repository indefinitely. Our customers and the community can continue to rely on JCenter as a reliable mirror for Java packages." source

Update: Google is working on a fix for build tools 4.2 and maybe 4.1 as well. source

Update: You could try a dependency resolve rule.


The top-level dependency, com.android.tools.build:gradle, started using a newer version of trove4j in 7.0.0-alpha01. (7.0.0-alpha12 is currently the latest.)

Dependency chain: com.android.tools.build:gradle:7.0.0-alpha01 -> com.android.tools.build:builder:7.0.0-alpha01 -> com.android.tools:sdk-common:27.3.0-alpha01 -> org.jetbrains.intellij.deps:trove4j:1.0.20181211

However, this version is still in alpha and requires Android Studio 4.3+, which isn't even in Beta yet.

I have filed a bug with Google here: https://issuetracker.google.com/issues/179291081

Westy92
  • 19,087
  • 4
  • 72
  • 54
  • 1
    Thanks for the updates and links but what can we do right now to fix this? resolutionStrategies in the google link don't seem to work. – Arno Mar 19 '21 at 16:41
2

The answer is outdated and is not useful anymore atleast as jcenter is down again with error of 403. The most useful answer can be found here Finally after hours of head bangs, issue resolved.

Update android/build.gradle, add the following at the top in allprojects -> repositories.

allprojects {
  repositories {
      all { ArtifactRepository repo ->
          println repo.url.toString()
          if (repo.url.toString().startsWith("https://jcenter.bintray.com/")) {
              project.logger.warn "Repository ${repo.url} removed."
              remove repo
              mavenCentral()
          }
      }
      gradlePluginPortal() // add this if you get further errors 
      ...other repos
  }
}

Thanks.

Faizal Shap
  • 1,680
  • 1
  • 11
  • 26