android - 错误重复“无法解析配置':app:debugRuntimeClasspath'的所有文件'
问题描述
当我尝试运行这个基本应用程序时,我得到“无法解析配置':app:debugRuntimeClasspath'的所有文件”。
gradle.build(应用程序)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-parcelize'
android {
compileSdkVersion 31
defaultConfig {
applicationId "hellokotlinandroid.gohool.com.buttonstextviewedittext"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7"
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.13.2'
}
gradle.build(项目)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.6.0-RC'
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
mavenCentral()
google()
}
}
这是完整的错误
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.6.0-RC.
Searched in the following locations:
- https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.6.0-RC/kotlin-stdlib-jre7-1.6.0-RC.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.6.0-RC/kotlin-stdlib-jre7-1.6.0-RC.pom
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.6.0-RC/kotlin-stdlib-jre7-1.6.0-RC.pom
Required by:
project :app
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
此错误重复多次,准确地说是 17 次,是同一件事,但每次的任务略有不同
我已经浏览了论坛并尝试了他们所说的但似乎找不到任何东西并尝试了所有基本的故障排除任何建议表示赞赏,谢谢!
解决方案
有同样的问题,就我而言,我做了以下这些
kotlinOptions { jvmTarget = "1.8" }
change to
kotlinOptions { jvmTarget = "11" }
基本上从 jdk 1.8 更改为 11。或者通过Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JDK (change to 11 or Embedded JDK)。
清理项目和重建项目。
推荐阅读
- android - 我有一个想法,我只需要有人为我指明正确的方向即可开始
- python - Selenium Instagram 登录:“WebElement”对象没有属性“send_Keys”
- reactjs - Redux 没有在功能组件中分派我的操作类型
- javascript - 将 req.body 数据快速传递到 Stripe 路由中进行支付
- string - Actionscript 3 错误 1176:具有静态类型 Function 的值与可能不相关的 int 类型之间的比较
- html - 所有设备/断点上的店面主题移动布局
- sequelize.js - Sequelize 和 nestJs 中的 LocalizedColumn 装饰器
- terraform - 属性“路由”的值不合适:元素 0:属性
- javascript - 如何遍历数组并使用下一个请求中的值(每次都有不同的值) - 邮递员
- python - 如何在 MLFlow 中的实验级别设置标签