升级到AS3.0遇到的问题汇总

一、

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0. Open File
。。。html

File->Settings->Build, Execution, Deployment->Gradle->取消Offline work选项的勾选,重构项目。
喜欢离线环境的能够重构完项目,从新打开。android

二、

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

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.测试

缘由:测试用的库的版本和app的不一致,致使依赖包冲突。ui

解决方法:
一、为测试指定版本spa

androidTestCompile('com.android.support:support-annotations:26.1.0') {
        force = true
    }

二、统一模块依赖版本debug

configurations.all { resolutionStrategy.force 'com.android.support:support-annotations:26.1.0' }