![](/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.