使用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'改变为applyplugin:'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"删除就行
网友评论