2016-11-03 32 views
9

enter image description here Lỗi: Thực thi không thành công cho công việc ': ứng dụng: chuẩn bịDebugAndroidTestDependencies'.Lỗi: Thực thi không thành công cho công việc ': ứng dụng: chuẩn bịDebugAndroidTestDependencies'. > Lỗi phụ thuộc. Xem bảng điều khiển để biết chi tiết

Dependency Error. See console for details.

Sau khi thêm các phụ thuộc sau đây trong tập tin app.gradle -

androidTestCompile 'com.android.support.test:runner:0.5' 
androidTestCompile 'com.android.support.test:rules:0.5' 
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 
// add this for intent mocking support 
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2' 
// add this for webview testing support 
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.2' 

điều khiển Logs -

Thông tin: nhiệm vụ Gradle [: Ứng dụng: làm sạch,: Ứng dụng: generateDebugSources,: Ứng dụng : mockableAndroidJar,: app: prepareDebugUnitTestDependencies,: app: generateDebugAndroidTestSources,: app: assembleDebug] Cảnh báo: Xung đột với phụ thuộc 'com.android.support:support-annotations'. Các phiên bản được giải quyết cho ứng dụng (25.0.0) và ứng dụng thử nghiệm (23.1.1) khác nhau. Xem http://g.co/androidstudio/app-test-app-conflict để biết chi tiết. Lỗi: Thực thi không thành công cho công việc ': ứng dụng: chuẩn bịDebugAndroidTestDependencies'.

Dependency Error. See console for details. Information:BUILD FAILED Information:Total time: 28.459 secs Information:1 error Information:1 warning Information:See complete output in console

Trả lời

11

tôi có probleme cùng, khi tôi thêm đoạn mã sau vào ứng dụng của tôi build.gradle trong android { }, đó là ok. configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1' } bạn có thể nhận được lý do tại trang này
Execution failed for task 'app:prepareDebugAndroidTestDependencies'

+1

Cảm ơn! Đã có cùng một vấn đề và điều này giải quyết nó – enyciaa

8

Bạn cần phải thêm dòng này vào phụ thuộc của bạn:

androidTestCompile 'com.android.support:support-annotations:25.0.0' 

để buộc sử dụng phiên bản mới nhất của thư viện

Bạn cũng có thể thử để loại trừ các gói xung đột như tôi đã làm cho thư viện espresso-contrib

dependencies { 
    ext.JUNIT_VERSION = '4.12' 
    ext.AA_VERSION = '4.0.0' 
    ext.SUPPORT_VERSION = '24.1.1' 
    ext.ESPRESSO_VERSION = '2.2.2' 

... 

    androidTestCompile "com.android.support:support-annotations:$SUPPORT_VERSION" 
    androidTestCompile "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION" 
    androidTestCompile 'com.android.support.test:runner:0.5' 
    androidTestCompile "com.android.support.test.espresso:espresso-intents:$ESPRESSO_VERSION" 
    /** 
    * AccessibilityChecks 
    * CountingIdlingResource 
    * DrawerActions 
    * DrawerMatchers 
    * PickerActions (Time and Date picker) 
    * RecyclerViewActions 
    */ 
    androidTestCompile("com.android.support.test.espresso:espresso-contrib:$ESPRESSO_VERSION") { 
     exclude group: 'com.android.support', module: 'appcompat' 
     exclude group: 'com.android.support', module: 'support-v4' 
     exclude group: 'com.android.support', module: 'support-v7' 
     exclude group: 'com.android.support', module: 'design' 
     exclude module: 'support-annotations' 
     exclude module: 'recyclerview-v7' 
    } 
1

Điều này xảy ra do xung đột phiên bản thư viện trong ứng dụng gỡ lỗi và ứng dụng thử nghiệm. Thêm thẻ này dưới thẻ android {}

configurations.all { 
    resolutionStrategy { 
     force 'com.android.support:support-annotations:24.1.1' 
    } 
} 
Các vấn đề liên quan