问答详情
源自:-

新建项目时 gradle build 报错

* What went wrong:

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.



按照报错提示,百度后试了各种办法,还是有这个错误,请问老师如何解决呢

提问者:慕前端5085637 2018-06-29 09:53

个回答

  • 雷利1
    2018-07-09 14:15:26

    在build.gradle 里面的android{}加入

    configurations.all {
        resolutionStrategy {
            force 'com.android.support:support-annotations:26.1.0'
        }
    }
    然后加入 dependencies {
        implementation 'com.android.support:appcompat-v7:26.1.0'
    }