[英]Gradle: Resolved versions for app and test app differ
When I add the dependency: 当我添加依赖项时:
compile 'net.bytebuddy:byte-buddy-android:0.7.8'
in my app, I get this error: 在我的应用程序中,我收到此错误:
Conflict with dependency 'net.bytebuddy:byte-buddy'. Resolved versions for app (0.7.8) and test app (0.6.14) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
I have visited http://g.co/androidstudio/app-test-app-conflict and it says: 我访问了http://g.co/androidstudio/app-test-app-conflict ,它说:
Gradle build will fail if the main APK and the test APK use the same library (eg Guava) but in different versions.[...] To make the build succeed, just make sure both APKs use the same version 如果主APK和测试APK使用相同的库(例如Guava)但是在不同的版本中,Gradle构建将失败。[...]为了使构建成功,只需确保两个APK使用相同的版本
But I don't know what it means. 但我不知道这意味着什么。
Can you help me? 你能帮助我吗? Thanks. 谢谢。
build.gradle 的build.gradle
...
buildTypes {
all {
//just build some config fields
}
demo.initWith(buildTypes.debug)
demo {
//just build some config fields
}
devel.initWith(buildTypes.debug)
devel {
//just build some config fields
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.gg
//just build some config fields
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
...
您可以使用以下方法强制测试中的版本:
androidTestCompile 'net.bytebuddy:byte-buddy-android:0.7.8'
You can force the version without adding an extraneous dependency by adding this to your gradle file 您可以通过将此项添加到gradle文件来强制该版本而不添加无关的依赖项
configurations.all {
resolutionStrategy {
force 'net.bytebuddy:byte-buddy-android:0.7.8'
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.