Pyt*_*ter 9 android gradle kotlin android-studio
当我使用 Gradle 在 Android Studio 中输出我的 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
}
Run Code Online (Sandbox Code Playgroud)
这是我的错误
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
Run Code Online (Sandbox Code Playgroud)
谁能帮忙,那将不胜感激,也将很高兴,谢谢...
Nit*_*ish 17
添加中央 Maven 存储库
repositories {
mavenCentral()
}
Run Code Online (Sandbox Code Playgroud)
可能的错误原因:
似乎当前 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 { ... }”。
| 归档时间: |
|
| 查看次数: |
19102 次 |
| 最近记录: |