使用AndroidStudio新建工程報錯
Error: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.
解決方法
在app下的build.gradle文件中的dependences {}中添加如下代碼
androidTestCompile('com.android.support:support-annotations:26.1.0') {
? ? ? ? force = true
? ? }
在將?build.gradle文件里的 //apply plugin: 'com.android.application'改變?yōu)閍pplyplugin:'com.android.library'時會報錯Error:Library projects cannot set applicationId. applicationId is set to 'liqingmu.com.myapplication' in default config.
解決方法只需要將該文件
defaultConfig {
applicationId "liqingmu.com.myapplication"
? ? minSdkVersion15
? ? targetSdkVersion26
? ? versionCode 1
? ? versionName "1.0"
? ? testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
下的applicationId "liqingmu.com.myapplication"刪除就行