简体   繁体   中英

Error: Conflict with dependency 'com.android.support:multidex' in project

I created a new android project with the following gradle file:

android {
   ...
   dexOptions {
        javaMaxHeapSize "4g"
    }
   ...
}

dependencies {
   ...
    compile 'com.linkedin.dexmaker:dexmaker-mockito:2.16.0'
   ...
}

But when I build my app I get:

Conflict with dependency 'com.android.support:multidex' in project ':app'. Resolved versions for app (1.0.3) and test app (1.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.

How can I solve this issue?

The error says you are using 2 versions of com.android.support:multidex .Check this https://stackoverflow.com/a/37357786/3111083 So in your case it should be

android {
    configurations.all {
        resolutionStrategy.force 'com.android.support:multidex:1.0.3'
    }
}

After changing this Clean and rebuild.

Mockito depends only on a specific version, so the dependency conflict should be on your side. Do you have any dependencies that depend on specific version? iein your build.gradle file. If so, you can try using a ResolutionStrategy to force 1.0.3 on them.

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