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

user924 picture user924 · May 6, 2021 · Viewed 19.3k times · Source

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()

Answer

Curt picture Curt · May 6, 2021

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.