简体   繁体   中英

Error:Conflict with dependency 'com.google.guava:guava' in project ':app'. Resolved versions for app (18.0) and test app (16.0.1) differ

I am getting below error,

  Error:Conflict with dependency 'com.google.guava:guava' in project ':app'.
  Resolved versions for app (18.0) and test app (16.0.1) differ

after adding the below line..

compile 'com.mobgen.halo.android:halo-plugin:2.0.0'

to dependencies in build.gradle file

below is the snapshot of build.gradle file

在此处输入图片说明

i tried adding below 2 approaches in build.gradle file, but didnt work

1.

configurations.all {
    resolutionStrategy.force 'com.google.guava:guava:18.0'
}

2.

  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
        exclude group: 'com.google.guava:guava'
    }

2 things:

  1. You're looking at the wrong thing. Guava is not a dependency of Espresso . It's a dependency of testng .
  2. Although I might not be entirely correct saying that you're excluding guava in a wrong way, but the following scheme will work for sure:

androidTestCompile ("org.testng:testng:6.9.6"){
    exclude group: 'com.google.guava', module:'guava'
}

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