遇到的错误1:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (27.0.2) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
解决办法:
在app下的gradle中添加如下:
android {
.....
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
dependencies {
.....
}
遇到问题2:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> More than one file was found with OS independent path 'META-INF/rxjava.properties'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
解决办法:
在app下的gradle中添加如下:
android { //添加这个
packagingOptions{ exclude 'META-INF/rxjava.properties' }}
记录一下