我想添加espresso-contrib庫到我的項目。這裏是我的build.gradle文件:Android衝突與依賴appcompat
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "example.com.littlebox_hari"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
/*configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:23.4.0'
}
}*/
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
androidTestCompile 'com.android.support.test:runner:0.4'
androidTestCompile 'com.android.support.test:rules:0.4'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
compile 'com.android.support:support-annotations:23.4.0'
testCompile 'com.android.support:support-annotations:23.4.0'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
}
我得到這個錯誤:
Error:Conflict with dependency 'com.android.support:appcompat-v7'. Resolved versions for app (23.4.0) and test app (23.1.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
如果我取消我的build.gradle文件中的行,我得到:
Error:(72) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Display1'.
Error:(75) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Caption'.
Error:(79) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Caption'.
Error:(76) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Caption'.
Error:(82) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Caption'.
Error:(89) Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Button'.
D:\Littlebox-Hari\app\build\intermediates\exploded-aar\com.android.support\design\23.1.1\res\values\values.xml
Error:(97, 5) No resource found that matches the given name: attr 'textAllCaps'.
Error:(102, 5) No resource found that matches the given name: attr 'elevation'.
Error:(113, 5) No resource found that matches the given name: attr 'backgroundTint'.
Error:(113, 5) No resource found that matches the given name: attr 'elevation'.
Error:(122, 5) No resource found that matches the given name: attr 'elevation'.
Error:(131, 5) No resource found that matches the given name: attr 'elevation'.
編輯:我將以下行添加到了我的build.gradle文件中:
testCompile 'com.android.support:appcompat-v7:23.4.0'
androidTestCompile 'com.android.support:appcompat-v7:23.4.0'
我仍然得到相同的錯誤。
你看了URL錯誤提供? –
[Gradle:應用程序和測試應用程序的已解決版本可能有所不同](http://stackoverflow.com/questions/34650509/gradle-resolved-versions-for-app-and-test-app-differ) –
已編輯 - 我得到了同樣的錯誤 – rhari