Resolving conflicts between main and test APK

来源:互联网 发布:网络线上赌博 编辑:程序博客网 时间:2024/06/07 20:21

解决方法
Resolving conflicts between main and test APK

When instrumentation tests are run, both the main APK and test APK share the same classpath. Gradle build will fail if the main APK and the test APK use the same library (e.g. Guava) but in different versions. If gradle didn’t catch that, your app could behave differently during tests and during normal run (including crashing in one of the cases).

To make the build succeed, just make sure both APKs use the same version. If the error is about an indirect dependency (a library you didn’t mention in your build.gradle), just add a dependency for the newer version to the configuration (“compile” or “androidTestCompile”) that needs it. You can also use Gradle’s resolution strategy mechanism. You can inspect the dependency tree by running ./gradlew :app:dependencies and ./gradlew :app:androidDependencies.

0 0
原创粉丝点击