// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is the error i am getting
A problem occurred evaluating root project 'LuckyMuch'.
Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'
Popular public repositories include Maven Central and the Google Android repository. Gradle provides built-in shorthand notations for these widely-used repositories. Under the covers Gradle resolves dependencies from the respective URL of the public repository defined by the shorthand notation.
Even I faced this issue, I have updated settings.gradle file with below code it worked for me
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Chat App"
include ':app'
I have the same problem and solved it. Go to settings.gradle file -> change below code: From this:
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
to this:
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
and add this line in the repository block: maven { url 'https://jitpack.io' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With