Gradle:应用程序和测试应用程序的已解决版本不同 [英] Gradle: Resolved versions for app and test app differ

查看:124
本文介绍了Gradle:应用程序和测试应用程序的已解决版本不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我添加依赖项时:

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.

我已经访问过 http://g.co/androidstudio/app-test-app -冲突并说:

如果主APK和测试APK使用相同的内容,则分级构建将失败 库(例如Guava),但版本不同.[...]进行构建 成功,只需确保两个APK使用相同的版本

Gradle build will fail if the main APK and the test APK use the same library (e.g. Guava) but in different versions.[...] To make the build succeed, just make sure both APKs use the same version

但是我不知道这意味着什么.

But I don't know what it means.

你能帮我吗?谢谢.

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
}

    ...

推荐答案

您可以使用以下命令在测试中强制使用该版本:

You can force the version in your test using:

androidTestCompile 'net.bytebuddy:byte-buddy-android:0.7.8'

这篇关于Gradle:应用程序和测试应用程序的已解决版本不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆