Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I just recently added some configurations to my android project and got the following error.Build was configured prefer setting repositories over project repositories but repository'Google'was added to the build file

What I have tried:

I have tried searching the internet but I was not able to find an answer.
here is my code:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository

}
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.3.13'

}
}

plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}



allprojects {
repositories {
google() // Google's Maven repository
}
}



task clean(type: Delete) {
delete rootProject.buildDir
}
Posted
Updated 26-Jul-22 18:42pm

1 solution

When you get an error you don't understand, google the whole error message: Build was configured prefer setting repositories over project repositories but repository'Google'was added to the build file - Google Search[^]
Loads of very relevant hits there, and the fourth one matches teh text pretty much exactly: How to solve "Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'" error in Android App development? - programmerworld[^]
Following that link gives a complete solution.

Did you try that?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900