In an app compiling against Api 23 (6.0), I get a warning in the build.gradle file that "All com.android.support libraries must use the exact same version specification" and that versions 24.2.0 & 23.1.1 were found.
My com.android.support dependencies all specify 23.1.1 but running:
gradlew -q dependencies app:dependencies --configuration compile
shows that these are all upgraded to 24.2.0.
The only exception to this is
com.google.dagger:dagger-android:2.9
which appears to be dependent on
com.android.support:support-v4:24.2.0
Excerpts from gradlew dependency report:
+--- project :AppCommon
| +--- com.android.support:appcompat-v7:23.1.1
| | \--- com.android.support:support-v4:23.1.1 -> 24.2.0
| | +--- com.android.support:support-compat:24.2.0
| | | \--- com.android.support:support-annotations:24.2.0
| | +--- com.android.support:support-core-utils:24.2.0
| | | \--- com.android.support:support-compat:24.2.0 (*)
| | +--- com.android.support:support-media-compat:24.2.0
| | | \--- com.android.support:support-compat:24.2.0 (*)
| | +--- com.android.support:support-core-ui:24.2.0
| | | \--- com.android.support:support-compat:24.2.0 (*)
| | \--- com.android.support:support-fragment:24.2.0
| | +--- com.android.support:support-compat:24.2.0 (*)
| | +--- com.android.support:support-core-utils:24.2.0 (*)
| | +--- com.android.support:support-media-compat:24.2.0 (*)
| | \--- com.android.support:support-core-ui:24.2.0 (*)
| +--- com.android.support:support-v4:23.1.1 -> 24.2.0 (*)
| +--- com.android.support:design:23.1.1
| | +--- com.android.support:appcompat-v7:23.1.1 (*)
| | +--- com.android.support:recyclerview-v7:23.1.1
| | | +--- com.android.support:support-annotations:23.1.1 -> 24.2.0
| | | \--- com.android.support:support-v4:23.1.1 -> 24.2.0 (*)
| | \--- com.android.support:support-v4:23.1.1 -> 24.2.0 (*)
| \--- com.google.dagger:dagger-android:2.9
| +--- com.google.dagger:dagger:2.9 (*)
| +--- com.android.support:support-v4:24.2.0 (*)
| \--- com.android.support:support-annotations:24.2.0
How can I resolve this dependency clash other than by changing compiling against api 24 (and changing all my com.android.support versions to 24.2.0)?
Update Gradle plugin to
classpath 'com.android.tools.build:gradle:2.3.3'
Change the gradle compile sdk version, buildtool version and target sdk version to a updated one.
For sample,
compileSdkVersion 25
buildToolsVersion "25.0.3"
targetSdkVersion 25
And change the gradle dependency to the same version of builtoolversion
compile 'com.android.support:support-compat:25.3.1'
compile 'com.android.support:support-media-compat:25.3.1'
compile 'com.android.support:support-core-ui:25.3.1'
compile 'com.android.support:support-fragment:25.3.1'
compile 'com.android.support:support-core-utils:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-annotations:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.dagger:dagger:2.0.2'
compile 'com.google.dagger:dagger-compiler:2.0.2'
You must use the dagger dependency as
compile 'com.google.dagger:dagger:2.0.2'
compile 'com.google.dagger:dagger-compiler:2.0.2'
instead of
com.google.dagger:dagger-android:2.9
com.google.dagger:dagger:2.9
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.