Gradle: Resolved versions for app and test app differ

Issue

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 (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.

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
}

    ...

Solution

You can force the version in your test using:

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

Answered By – Gabriele Mariotti

Leave a Comment