Error While creating new project with android studio 3.0.1

后端 未结 2 1114
慢半拍i
慢半拍i 2021-01-24 14:01

Error:Execution failed for task \':app:preDebugAndroidTestBuild\'.

Conflict with dependency \'com.android.support:support-annotations\' in project \':app\

相关标签:
2条回答
  • 2021-01-24 14:52

    you can also go for this one.

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

    instead of this,

    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'
    
    0 讨论(0)
  • 2021-01-24 15:06

    Based on the documentation:

    Both your app APK and its test APK share the same classpath. So, you can get a build error if both APKs depend on different versions of the same library.

    So the fix would be to change your

    com.android.support:appcompat-v7:26.1.0

    to

    com.android.support:appcompat-v7:27.1.1

    0 讨论(0)
提交回复
热议问题