當我在 Android Studio 中使用 Gradle 輸出我的 Android 應用程式時,我遇到了一個問題,我收到了這樣的錯誤,錯誤是同步的,然后我嘗試同步并且 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
誰能幫忙,將不勝感激,會很高興,謝謝...
uj5u.com熱心網友回復:
添加中央 Maven 存盤庫
repositories {
mavenCentral()
}
錯誤的可能原因:
目前 android studio 似乎正在嘗試org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.10從 location下載 library( ) "https://dl.google.com/dl/android/maven2",但由于某種原因,它找不到錯誤中解釋的pom 檔案。
如果您嘗試檢索的工件可以在存盤庫中找到,但沒有 'Maven POM' 格式的元資料,則需要調整存盤庫宣告的 'metadataSources { ... }'。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/381954.html
