What a problem
Some libraries depend on version βXβ or βNewerβ on Android support libraries, so Gradle dependency resolution captures everything that is newest available, ignoring that you really have the exact version specified in your dependencies block.
This is not what you want. You want all support libraries with the same version and major version to match the compilation of the SDK version.
What solution
Fortunately, you can force the installation of a specific version of the support library.
Put this at the end of your build.gradle application build.gradle :
configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '25.3.0' } } } }
Of course, replace the version with what you are using.
Version values ββfor support libraries in the dependecies block dependecies now irrelevant.
If in doubt
This is a well documented method and it works.
What can you do to help
Find libraries that depend on the range of support library versions
gradlew dependencies --configuration compile -p <module name> | grep ,
and let the authors of these libraries know that they should be transitively dependent on the oldest support libraries that their library can work with.
The goal is to avoid the problem at all.
Eugen Pechanec Mar 22 '17 at 16:14 2017-03-22 16:14
source share