androidmavenandroid-studioandroid-gradle-pluginjcenter

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


Solution

  • For koin, change the group id from org.koin to io.insert-koin - the latter is published on maven central.

    For chartboost, you can use the following repo:

    maven {
        url "https://dl.bintray.com/google/mobile-ads-adapters-android/"
    }
    

    Also note that there are newer versions such as koin 2.2.2 / 3.0.1 and chartboost 8.2.0.0. Older versions are likely not republished in non-jcenter repos.

    mvnrepository is a good service for locating packages.