Android 无法解析gradle中的测试运行程序依赖项
我正在android studio中创建新项目,但在创建项目后,它显示以下错误:Android 无法解析gradle中的测试运行程序依赖项,android,Android,我正在android studio中创建新项目,但在创建项目后,它显示以下错误: ERROR: Failed to resolve: androidx.test.espresso:espresso-core:3.2.1 Show in Project Structure dialog Affected Modules: app ERROR: Failed to resolve: androidx.test:runner:1.2.1 Show in Project Structure dialo
ERROR: Failed to resolve: androidx.test.espresso:espresso-core:3.2.1
Show in Project Structure dialog
Affected Modules: app
ERROR: Failed to resolve: androidx.test:runner:1.2.1
Show in Project Structure dialog
Affected Modules: app
以下是我的gradle文件依赖项:
app.gradle
dependencies {
def lifecycle_version = "2.0.0"
def room_version = "2.2.0-alpha01"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.1'
androidTestImplementation 'androidx.test:runner:1.2.1'
//View model and live data
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
//Room
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
}
注释
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
// 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
}
有人请让我知道为什么上述错误是显示,我如何才能克服它。任何帮助都将不胜感激
谢谢你的版本来自哪里?官方版本仅适用于3.1.0
参考这篇Ohh,我的错误实际上是3.2.0,我将它升级到了错误的3.2.1版本。