gpt4 book ai didi

android - 输出程序时出现 Gradle 构建错误

转载 作者:行者123 更新时间:2023-12-04 23:47:02 24 4
gpt4 key购买 nike

我在使用 Gradle 在 Android Studio 中输出我的 Android APP 时遇到问题,我收到这样的错误,错误是同步的,然后我尝试同步并且 AVD 正在工作,并且同步工作,但是现在,也许我在使用 Gradle 输出时遇到了同样的问题,我认为这可能会有所帮助,我重置了我的笔记本电脑,所以所有东西都被删除了,我重新安装了 Android Studio 和所有东西,这是我的第一次测试,并为 Gradle 运行也。
这是我得到的 build.gradle

    // 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
}
这是我的错误
    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...

最佳答案

添加中央 Maven 存储库

repositories {
mavenCentral()
}
可能的错误原因 :
目前看来 android studio 正在尝试从位置 org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.10 下载库( "https://dl.google.com/dl/android/maven2" ) ,但由于某种原因找不到 pom file如错误中所述。
如果您尝试检索的工件可以在存储库中找到但没有“Maven POM”格式的元数据,则需要调整存储库声明的“metadataSources { ... }”。

关于android - 输出程序时出现 Gradle 构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70359416/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com