Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ

后端 未结 6 1396
挽巷
挽巷 2020-12-31 00:42

I came across this exception while adding espresso to an android project. I already try the link that comes with this exception

**Conflict with dependency \'         


        
6条回答
  •  感情败类
    2020-12-31 01:17

    Nowadays when you create a new project on Android Studio, it adds this dependency by default:

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    

    The exclude section is probably to avoid the conflict mentioned in the question. I also faced this issue when trying to add runner:0.5 and rules:0.5 dependencies. My solution was to apply the same piece of code above on them:

    androidTestCompile ('com.android.support.test:runner:0.5', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    
    androidTestCompile ('com.android.support.test:rules:0.5', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    

    It works for me. Hope it helps.

提交回复
热议问题