종속성 'com.android.support:support-annotations'와 충돌합니다. 앱 (23.1.0) 및 테스트 앱 (23.0.1)의 해결 된 버전이 다릅니다.
빌드 할 때 다음 오류가 발생합니다.
Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ.
이것들은 내 gradle 의존성입니다.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.8'
compile 'com.snappydb:snappydb-lib:0.5.2'
compile 'com.esotericsoftware.kryo:kryo:2.24.0'
compile 'com.google.dagger:dagger:2.0.1'
apt 'com.google.dagger:dagger-compiler:2.0.1'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'io.reactivex:rxandroid:1.0.1'
compile 'io.reactivex:rxjava:1.0.14'
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'org.apache.commons:commons-lang3:3.4'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:1.10.19'
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.espresso:espresso-intents:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.1'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
이 문제를 어떻게 해결할 수 있습니까?
다음을 사용하여 테스트에서 주석 라이브러리를 강제 실행할 수 있습니다.
androidTestCompile 'com.android.support:support-annotations:23.1.0'
이 같은:
// Force usage of support annotations in the test app, since it is internally used by the runner module.
androidTestCompile 'com.android.support:support-annotations:23.1.0'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.1'
또 다른 해결책은 최상위 파일에서 이것을 사용하는 것입니다.
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.1.0'
}
Project Rebuild가 내 문제를 해결했습니다.
툴바의 Android 스튜디오에서. 빌드> 프로젝트 다시 빌드.
출처 : CodePath-Espresso를 사용한 UI 테스트
- 마지막으로 Espresso 의존성을 끌어 내고 앱 build.gradle에서 테스트 러너를 설정해야합니다.
// build.gradle
...
android {
...
defaultConfig {
...
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
...
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
// Necessary if your app targets Marshmallow (since Espresso
// hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test:runner:0.5') {
// Necessary if your app targets Marshmallow (since the test runner
// hasn't moved to Marshmallow yet)
exclude group: 'com.android.support', module: 'support-annotations'
}
}
내 gradle 파일에 추가했는데 경고가 사라졌습니다.
또한 지원 주석과 같이 충돌하는 것으로 나열된 다른 종속성이 있으면 androidTestCompile 종속성에서도 제외하십시오.
당신은 사용하려고 할 수 있습니다
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
instead of
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'
I was getting this error
Error:Execution failed for task ':app:preDebugAndroidTestBuild'. Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
I was having following dependencies in my build.gradle file under Gradle Scripts
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
So, I resolved it by commenting the following dependencies
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
So my dependencies look like this
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'com.android.support.test:runner:1.0.2'
//androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Hope it helps!
I was getting the same error today:
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ.
What I did:
- I simply updated all my dependencies to
27.1.1
instead of26.1.0
- Also, updated my
compileSdkVersion 27
andtargetSdkVersion 27
which were26
earlier
And com.android.support:support-annotations
error was gone!
For Ref:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
In my case, I added below code in dependencies of app level build.gradle
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
After that, I clean the project and rebuild.My problem solved.
Chang your application level build.gradle file's:
implementation 'com.android.support:appcompat-v7:23.1.0'
to
implementation 'com.android.support:appcompat-v7:23.0.1'
Try this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.yourpackagename"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
'Programming' 카테고리의 다른 글
DFS와 BFS O (V + E)의 시간이 복잡한 이유 (0) | 2020.07.16 |
---|---|
Gradle artifact 종속성 그래프 명령은 무엇입니까? (0) | 2020.07.16 |
공백이있는 jquery ID (0) | 2020.07.16 |
두 날짜 사이의 월 차이 계산 (0) | 2020.07.16 |
MySQL : LOAD DATA LOCAL INFILE 활성화 (0) | 2020.07.16 |