1

내 앱용 계측 단위 테스트를 설정하려고합니다. 아래 개발자 사이트 링크를 기반으로 종속성이 추가되었습니다.의존성과의 충돌 'com.android.support : support-annotations'

Error:Conflict with dependency 'com.android.support:support-annotations' in project ':MyApp'. Resolved versions for the app (21.0.3) and test app (24.0.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details. 

사람이이 문제를 해결하는 데 도움이 시겠어요 :

https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html#build

이것은 내가 아래 컴파일 오류가 발생하고 프로젝트를 빌드 할 때

dependencies { 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:support-v4:21.0.3' 
    testCompile 'junit:junit:4.12' 
    testCompile 'org.mockito:mockito-core:1.10.19' 
    androidTestCompile 'com.android.support:support-annotations:24.0.0' 
    androidTestCompile 'com.android.support.test:runner:0.5' 
    androidTestCompile 'com.android.support.test:rules:0.5' 
} 

내 의존성 목록입니다 .

답변

3

주석은 지원 라이브러리의 일부입니다. 그래서, 주석 및 라이브러리 버전을 지원은 동일해야합니다 그리고 당신은 내가 지금 See here

configurations.all { 
    resolutionStrategy { 
    force 'com.android.support:support-annotations:21.0.3' 
    } 
} 
+0

내가 21.0.3로 변경 한 코드가 dependencies.For 자세한 내용 위에 배치해야합니다 .This 이하의 코드를 사용하여 강제 호출해야 이 오류가 나타납니다. 오류 : ': MyApp'프로젝트의 'com.android.support : support-annotations'종속성과 충돌합니다. app (21.0.3) 및 test app (23.1.1)의 해결 된 버전이 다릅니다. 자세한 내용은 http://g.co/androidstudio/app-test-app-conflict를 참조하십시오. – Vji

+0

감사합니다 Priya ... – Vji

+0

귀하의 환영 :) –