简体   繁体   中英

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:

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

But I don't know what it means.

Can you help me? Thanks.

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

configurations.all {
    resolutionStrategy {
        force 'net.bytebuddy:byte-buddy-android:0.7.8'
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM