Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Gradle: Please remove usages of `jcenter()` Maven repository from your build scripts / JCenter is at end of life

In Android Studio 4.2 there is a warning:

enter image description here

buildscript {     ext.kotlin_version = '1.5.0'      repositories {         google()         //jcenter()         mavenCentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:4.2.0'         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"     } }  allprojects {     repositories {         google()         //jcenter()         mavenCentral()     } } 

If I remove jcenter() then it can't find some dependencies of my app project:

   > Could not find org.koin:koin-core:2.0.1.      Required by:          project :app    > Could not find org.koin:koin-androidx-scope:2.0.1.      Required by:          project :app    > Could not find org.koin:koin-androidx-viewmodel:2.0.1.      Required by:          project :app    > Could not find com.google.ads.mediation:chartboost:8.1.0.0.      Required by:          project :app 

In replace of jcenter() I added mavenCentral()

like image 884
user924 Avatar asked May 06 '21 12:05

user924


People also ask

Is JCenter removed?

Breaking down JFrog's announcement, this means the following for Android developers for their app's dependencies: March 31st 2021 - Libraries in JCenter will no longer be updated. February 1, 2022 - JCenter will be completely shut down.

Why is gradle using JCenter?

The Gradle Build Init plugin produces build templates that use the JCenter repository to resolve dependencies. In many code examples and documentation, JCenter is used as an example repository. It's very likely that you have builds that rely on JCenter.

What is JCenter repository in gradle?

JCenter Android. jCenter is the public repository hosted at bintray that is free to use for open source library publishers. It is the largest repository in the world for Java and Android OSS libraries, packages and components.

How do I replace my JCenter?

Luckily, it is an easy change. All you need to do is change jcenter() to mavenCentral() in your build. gradle file. I wrote a blog post explaining a bit more background and how to search in github/switch efficiently.


1 Answers

Move mavenCentral() above jcenter().

do a clean/build on your project.

comment out jcenter()

By moving mavenCentral() above jcenter(), mavenCentral() now becomes the primary repository for all non Google artifacts. By doing a clean and build, all artifacts are now moved to mavenCentral().

I had to look this up and tried it. I went from all heck breaking loose after I removed jcenter() to being able to build my final project for school again.

like image 138
Curt Avatar answered Oct 03 '22 05:10

Curt