![](/img/trans.png)
[英]Failed to resolve: com.android.support.test.espresso:espresso-core:3.0.1 Using Android Studio 3.0.1
[英]Failed to resolve: com.android.support.test.espresso
我的build.gradle文件如下:
应用插件:“ com.android.application”
android {
compileSdkVersion 26
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.xavier.hello"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
依赖项{
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
排除组:“ com.android.support”,模块:“ support-annotations”
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
每次都会给出以下错误:
我想尝试浓缩咖啡时遇到了同样的问题。
我已经通过添加解决了
maven {
url "https://maven.google.com"
}
至
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
这可能是由两个不同的问题引起的:
我的问题是Internet连接。 尝试构建项目时,我实际上已连接到Internet,但是连接速度很慢。 有了稳定的wifi后,我再次运行了构建,此问题就消失了。 正如Android Studio会告诉您的那样,您可能还需要调整运行在线/离线设置。 在项目的build.gradle文件中,您的存储库中应具有以下Maven参考:
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google() //you may or may not need this line
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.