- Add mavenCentral() to your repositories:Open your project-level build.gradle file (the one located at D:/20-6-2016/laughingadda/build.gradle) and add mavenCentral() to the repositories blocks within buildscript and allprojects.Gradle// Top-level build file where you can add configuration options common to all sub-projects/modules.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral() // <--- Add this
}
dependencies {
classpath 'com.android.tools.build:gradle:8.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral() // <--- Add this
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Explanation:•google(): This repository hosts Android-specific libraries.•mavenCentral(): This is a widely used repository that hosts a vast number of Java and Kotlin libraries, including org.jetbrains.kotlin:kotlin-stdlib and com.google.code.findbugs:jsr305.
Sync your project:After making these changes, click the “Sync Project with Gradle Files” button in Android Studio (it usually appears as an elephant icon with a sync arrow in the toolbar).If the problem persists, here are a few other things to check:•Internet Connection: Ensure you have a stable internet connection. Gradle needs to download these dependencies.•Firewall/Proxy: If you are behind a corporate firewall or proxy, you might need to configure Gradle to work with it. You can find instructions on how to do this in the Gradle documentation.•Offline Mode: Make sure Gradle is not in offline mode. You can check this in Android Studio by going to File > Settings > Build, Execution, Deployment > Gradle and ensuring “Offline work” is unchecked.•Gradle Version: While your Android Gradle Plugin version (8.12.2) is quite new, ensure it’s compatible with your Android Studio version and the Kotlin version you intend to use in your module-level build.gradle files. The error indicates it’s trying to find Kotlin 2.1.20, which is a very recent version.•Clear Caches: Sometimes, corrupted caches can cause issues. You can try clearing the Gradle caches by running ./gradlew cleanBuildCache in the terminal within your project directory, or by using the “Invalidate Caches / Restart” option in Android Studio (File > Invalidate Caches / Restart).Start with adding mavenCentral() to your repositories, as that’s the most common solution for this type of error.