here is a snippet of my build.gradle:
compile \'com.google.api-client:google-api-client:1.19.0\'
compile \'com.google.apis:google-api-services-oauth2:v2-rev7
Seems like Gradle works in such a way that every dependency brings all its transitive dependencies. And if you exclude some of them from one dependency they might been brought by the others.
So if you have
compile 'com.google.api-client:google-api-client:1.19.0'
compile 'com.google.apis:google-api-services-oauth2:v2-rev77-1.19.0'
compile 'com.google.apis:google-api-services-plus:v1-rev155-1.19.0'
in order to exclude com.google.guava:guava-jdk5 from the build process you have to exclude it from each of them:
compile ('com.google.api-client:google-api-client:1.19.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
compile ('com.google.apis:google-api-services-oauth2:v2-rev77-1.19.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
compile ('com.google.apis:google-api-services-plus:v1-rev155-1.19.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
dependencyInsight can help to find out where to put exclude. It shows a list of dependencies that have specific dependency in its transitive dependencies (unfortunately it doesn't show which of them have already excluded it in configuration)
More simple approach is to exclude a dependency from whole configuration (or from all configurations):
configurations.all {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
Reference: https://docs.gradle.org/current/userguide/resolution_rules.html#excluding_a_dependency_from_a_configuration_completely