Android 无法解析';的依赖关系:app@debugUnitTest/compileClasspath';
当我尝试添加新项目并修改我的渐变(添加依赖项)时,我在同步渐变后收到以下消息: 无法解析“”的依赖项:app@debugAndroidTest/compileClasspath':无法下载kotlin-stdlib-1.4.31.jar(org.jetbrains.kotlin:kotlin stdlib:1.4.31) 显示细节 受影响模块:应用程序 我无法单击“显示详细信息”链接 Gradle项目Android 无法解析';的依赖关系:app@debugUnitTest/compileClasspath';,android,kotlin,gradle,Android,Kotlin,Gradle,当我尝试添加新项目并修改我的渐变(添加依赖项)时,我在同步渐变后收到以下消息: 无法解析“”的依赖项:app@debugAndroidTest/compileClasspath':无法下载kotlin-stdlib-1.4.31.jar(org.jetbrains.kotlin:kotlin stdlib:1.4.31) 显示细节 受影响模块:应用程序 我无法单击“显示详细信息”链接 Gradle项目 buildscript { ext.kotlin_version = "1.
buildscript {
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.2"
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
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Gradle应用程序
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
尝试用以下内容替换第二个依赖项:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"