错误重复"无法解析配置的所有文件':app:debug运行时类路径'



当我尝试运行这个基本应用程序时,我得到了"无法解析配置的所有文件":app:debugRuntimeClasspath " .">

gradle。构建(app)

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。构建(项目)

// 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 ->构建、执行、部署->构建工具->Gradle→Gradle JDK(更改为11或Embedded JDK).

Clean Project and Rebuild Project.

相关内容