Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle.kts’

I’ve recently finished making my App and try to adding Ads to it by following this developers.google

I added the Google’s Maven repository and Maven central repository in my top-level build.gradle.kts like this:

/ Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id("com.android.application") version "8.2.1" apply false
    id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}

buildscript{
    repositories{
        google()
        mavenCentral()
    }
}

allprojects{
    repositories{
        google()
        mavenCentral()
    }
}

And then sync the Gradle project and it shows this:

Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle.kts’

I expect there is some problem relating to the file or the dependencies.

Leave a Comment