Gradle Building Error while outputting the program
Asked Answered
W

2

11

I am facing an issue when I am Using Gradle to output my Android APP in Android Studio, I am getting such error, the error was there in sync, then I tried to sync and the AVD was working, and the sync worked, but now, maybe I face the same issue while using Gradle to output, and I think this might help, that I reset my laptop, so everything is removed, and I reinstalled Android Studio and everything, and this is my first test, and run for Gradle too.

Here is my build.gradle which I get

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.5.10"
    repositories {
        google()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
        classpath "org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.10"
 
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
 
allprojects {
    repositories {
        google()
    }
}
 
task clean(type: Delete) {
    delete rootProject.buildDir
}

Here is my error

    Could not determine the dependencies of task ':app:kaptDebugKotlin'.

> Could not resolve all files for configuration ':app:kotlinKaptWorkerDependencies'.

> Could not find org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.10.

Searched in the following locations:

- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-annotation-processing-gradle/1.5.10/kotlin-annotation-processing-gradle-1.5.10.pom

If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.

Required by:

project :app



Possible solution:

- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Who could help, that would be appreciated and would be happy, thank you...

Willie answered 15/12, 2021 at 6:46 Comment(5)
I am looking for some kind of solution, I have searched for a solution, some I didn't understand, some I did understand them, but didn't solve my errorWillie
Try adding mavenCentral() , repositories { mavenCentral() }Dubitation
I tried that before, but let me try again.Willie
It is building, let us see the result, oh it worked, let me just confirm that.Willie
Yeah, it worked, thank you.., kindly post that as an answerWillie
D
18

Add central Maven repository

repositories {
    mavenCentral()
}

Possible cause of error :
It seems currently android studio is trying to download library( org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.10) from location "https://dl.google.com/dl/android/maven2" , but for some reason it couldn't find pom file as explained in the error.
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.

Dubitation answered 15/12, 2021 at 7:24 Comment(1)
But that passed, it came out with another issueWillie
G
0

Add both google and mavenCentral in repositories in build.gradle file

.
.
.
repositories {
  google()
  mavenCentral()
}
.
.
.
Graham answered 22/8 at 8:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.