54

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

user924
  • 8,146
  • 7
  • 57
  • 139

11 Answers11

64

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.

AndroidFreak
  • 866
  • 1
  • 10
  • 31
Curt
  • 649
  • 3
  • 2
9

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.

laalto
  • 150,114
  • 66
  • 286
  • 303
5

just commenting out jcenter() will help, mavencentral() is already above jcenter.

roropanda
  • 227
  • 3
  • 13
4

Locate all build.gradle files in your project folder tree, open them and replace jcenter() by mavenCentral(). It works for me most of the time.

steph643
  • 2,343
  • 1
  • 23
  • 20
2

It is interesting that the AndroidStudio project template still adds the ref to jcenter() to gradle, but then as soon as the project attempts to build it requests that you remove it.

I just delete it from the gradle file and then it works.

remove jcenter()

raddevus
  • 8,142
  • 7
  • 66
  • 87
2

So there are two issues here.

  1. First, we need to move MavenCentral above jCenter in all projects

  2. Second, Android build tools version need to upgraded to 4.2.0 and above. As Android internal build tool dependencies are going to jCenter

    dependencies { classpath("com.android.tools.build:gradle:4.2.0") }

It should work

Amit
  • 2,389
  • 22
  • 29
1

Hope this will help

  1. Go to App/Gradle Scripts/build.gradle (Project:---)
  2. Change the jcenter() on build script{} and in all project repositories.
  3. and Sync now.

This is how it looklike before.

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and after.

  buildscript {
    repositories {
        google()
        mavencentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.1'
    }
}

allprojects {
    repositories {
        google()
        mavencentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Sambhav Khandelwal
  • 3,585
  • 2
  • 7
  • 38
V. Hruaia
  • 29
  • 2
0

This might help someone.

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

I used this to resolve:

> Could not find com.github.parse-community.Parse-SDK-Android:parse:1.26.0.
     Required by:
         project :app
M Umer
  • 353
  • 6
  • 13
0

I got the same error, while i was using the Android Studio Artic Fox Beta - 3 but after change Android Studio as Canary Build the error gone

FGH
  • 2,900
  • 6
  • 26
  • 59
-1

The solution is simpe just Locate build.gradle and replace jcenter() by mavenCentral().

good luck

-2

The solution I did was to change build:gradle version:

dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

Adel
  • 269
  • 3
  • 9