Gradle混合版本27.1.1和26.1.0

时间:2018-04-24 19:15:24

标签: android gradle

我在我的应用级build.gradle中遇到错误,在我使用的第一个支持库上,它告诉我所有com.android.support库必须使用完全相同的版本规范并且它& #39;发现版本27.1.1和26.0.2。在我的app级build.gradle中,没有使用26.1.0的行。此外,所有compile语句都已更改为implementationcompileSdkVersion为27,targetSdkVersion为27.要尝试查找罪魁祸首,我跑了:

./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath

得到以下输出:

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations

------------------------------------------------------------
Project :app
------------------------------------------------------------

debugAndroidTestCompileClasspath - Resolved configuration for compilation for variant: debugAndroidTest
+--- com.android.support.test:runner:1.0.1
|    +--- com.android.support:support-annotations:25.4.0 -> 27.1.1
|    +--- junit:junit:4.12
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    \--- net.sf.kxml:kxml2:2.3.0
+--- com.android.support.test.espresso:espresso-core:3.0.1
|    +--- com.android.support.test:runner:1.0.1 (*)
|    +--- com.android.support.test:rules:1.0.1
|    |    \--- com.android.support.test:runner:1.0.1 (*)
|    +--- com.android.support.test.espresso:espresso-idling-resource:3.0.1
|    +--- com.squareup:javawriter:2.1.1
|    +--- javax.inject:javax.inject:1
|    +--- org.hamcrest:hamcrest-library:1.3
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- org.hamcrest:hamcrest-integration:1.3
|    |    \--- org.hamcrest:hamcrest-library:1.3 (*)
|    \--- com.google.code.findbugs:jsr305:2.0.1
+--- com.android.support:appcompat-v7:27.1.1
|    +--- com.android.support:support-annotations:27.1.1
|    +--- com.android.support:support-core-utils:27.1.1
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    \--- com.android.support:support-compat:27.1.1
|    |         +--- com.android.support:support-annotations:27.1.1
|    |         \--- android.arch.lifecycle:runtime:1.1.0
|    |              +--- android.arch.lifecycle:common:1.1.0
|    |              \--- android.arch.core:common:1.1.0
|    +--- com.android.support:support-fragment:27.1.1
|    |    +--- com.android.support:support-compat:27.1.1 (*)
|    |    +--- com.android.support:support-core-ui:27.1.1
|    |    |    +--- com.android.support:support-annotations:27.1.1
|    |    |    +--- com.android.support:support-compat:27.1.1 (*)
|    |    |    \--- com.android.support:support-core-utils:27.1.1 (*)
|    |    +--- com.android.support:support-core-utils:27.1.1 (*)
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    +--- android.arch.lifecycle:livedata-core:1.1.0
|    |    |    +--- android.arch.lifecycle:common:1.1.0
|    |    |    +--- android.arch.core:common:1.1.0
|    |    |    \--- android.arch.core:runtime:1.1.0
|    |    |         \--- android.arch.core:common:1.1.0
|    |    \--- android.arch.lifecycle:viewmodel:1.1.0
|    +--- com.android.support:support-vector-drawable:27.1.1
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    \--- com.android.support:support-compat:27.1.1 (*)
|    \--- com.android.support:animated-vector-drawable:27.1.1
|         +--- com.android.support:support-vector-drawable:27.1.1 (*)
|         \--- com.android.support:support-core-ui:27.1.1 (*)
+--- com.android.support:design:27.1.1
|    +--- com.android.support:support-v4:27.1.1
|    |    +--- com.android.support:support-compat:27.1.1 (*)
|    |    +--- com.android.support:support-media-compat:27.1.1
|    |    |    +--- com.android.support:support-annotations:27.1.1
|    |    |    \--- com.android.support:support-compat:27.1.1 (*)
|    |    +--- com.android.support:support-core-utils:27.1.1 (*)
|    |    +--- com.android.support:support-core-ui:27.1.1 (*)
|    |    \--- com.android.support:support-fragment:27.1.1 (*)
|    +--- com.android.support:appcompat-v7:27.1.1 (*)
|    +--- com.android.support:recyclerview-v7:27.1.1
|    |    +--- com.android.support:support-annotations:27.1.1
|    |    +--- com.android.support:support-compat:27.1.1 (*)
|    |    \--- com.android.support:support-core-ui:27.1.1 (*)
|    \--- com.android.support:transition:27.1.1
|         +--- com.android.support:support-annotations:27.1.1
|         \--- com.android.support:support-compat:27.1.1 (*)
+--- com.android.support.constraint:constraint-layout:1.1.0
|    \--- com.android.support.constraint:constraint-layout-solver:1.1.0
+--- com.android.support:support-vector-drawable:27.1.1 (*)
+--- com.android.support:support-v4:27.1.1 (*)
+--- com.android.support:cardview-v7:27.1.1
|    \--- com.android.support:support-annotations:27.1.1
+--- com.android.support:recyclerview-v7:27.1.1 (*)
+--- com.google.android.gms:play-services-ads:15.0.0
|    +--- com.android.support:customtabs:26.1.0
|    |    +--- com.android.support:support-compat:26.1.0 -> 27.1.1 (*)
|    |    \--- com.android.support:support-annotations:26.1.0 -> 27.1.1
|    +--- com.google.android.gms:play-services-ads-base:[15.0.0] -> 15.0.0
|    +--- com.google.android.gms:play-services-ads-identifier:[15.0.0,16.0.0) -> 15.0.0
|    |    \--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0
|    |         \--- com.android.support:support-v4:26.1.0 -> 27.1.1 (*)
|    +--- com.google.android.gms:play-services-ads-lite:[15.0.0] -> 15.0.0
|    |    +--- com.google.android.gms:play-services-ads-base:[15.0.0] -> 15.0.0
|    |    \--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|    \--- com.google.android.gms:play-services-gass:[15.0.0] -> 15.0.0
|         +--- com.google.android.gms:play-services-ads-base:[15.0.0] -> 15.0.0
|         \--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
+--- com.google.firebase:firebase-core:15.0.0
|    \--- com.google.firebase:firebase-analytics:[15.0.0,16.0.0) -> 15.0.0
|         +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|         +--- com.google.android.gms:play-services-measurement-base:[15.0.0] -> 15.0.0
|         +--- com.google.android.gms:play-services-stats:[15.0.0,16.0.0) -> 15.0.0
|         |    \--- com.google.android.gms:play-services-basement:[15.0.0] -> 15.0.0 (*)
|         +--- com.google.firebase:firebase-analytics-impl:[15.0.0] -> 15.0.0
|         |    +--- com.google.android.gms:play-services-ads-identifier:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |    +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |    +--- com.google.android.gms:play-services-measurement-base:[15.0.0] -> 15.0.0
|         |    +--- com.google.android.gms:play-services-stats:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |    +--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.0
|         |    |    \--- com.google.android.gms:play-services-basement:[15.0.0] -> 15.0.0 (*)
|         |    +--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.0
|         |    |    +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |    |    \--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |    \--- com.google.firebase:firebase-iid:[15.0.0] -> 15.0.0
|         |         +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |         +--- com.google.android.gms:play-services-measurement-base:[15.0.0] -> 15.0.0
|         |         +--- com.google.android.gms:play-services-stats:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |         +--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.0 (*)
|         |         \--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.0 (*)
|         \--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.0 (*)
+--- com.google.firebase:firebase-database:15.0.0
|    +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.firebase:firebase-database-collection:[15.0.0,16.0.0) -> 15.0.0
|    |    \--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|    \--- com.google.firebase:firebase-database-connection:[15.0.0] -> 15.0.0
|         +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|         +--- com.google.firebase:firebase-analytics:[15.0.0,16.0.0) -> 15.0.0 (*)
|         \--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.0 (*)
+--- com.google.firebase:firebase-firestore:15.0.0
|    +--- com.google.android.gms:play-services-basement:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.android.gms:play-services-tasks:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.firebase:firebase-analytics:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.firebase:firebase-common:[15.0.0,16.0.0) -> 15.0.0 (*)
|    +--- com.google.firebase:firebase-database-collection:[15.0.0,16.0.0) -> 15.0.0 (*)
|    \--- com.squareup.okhttp:okhttp:2.7.2
|         \--- com.squareup.okio:okio:1.6.0
+--- com.aurelhubert:ahbottomnavigation:2.1.0
|    \--- com.android.support:design:25.3.1 -> 27.1.1 (*)
+--- com.github.bumptech.glide:glide:4.5.0
|    +--- com.github.bumptech.glide:gifdecoder:4.5.0
|    |    \--- com.android.support:support-annotations:27.0.2 -> 27.1.1
|    +--- com.github.bumptech.glide:disklrucache:4.5.0
|    +--- com.github.bumptech.glide:annotations:4.5.0
|    \--- com.android.support:support-fragment:27.0.2 -> 27.1.1 (*)
+--- de.hdodenhof:circleimageview:2.2.0
+--- me.tankery.lib:circularSeekBar:1.1.4
+--- com.github.fiskurgit:ChipCloud:3.0.5
|    \--- com.android.support:appcompat-v7:25.1.1 -> 27.1.1 (*)
\--- com.google.android:flexbox:0.3.2

(*) - dependencies omitted (listed previously)

此处显示com.android.support:customtabs:26.1.0中的com.google.android.gms:play-services-ads:15.0.0正在使用26.1.0,但在下钻时它有-> 27.1.1 (*),我假设它意味着它使用了27.1 .1相反?我在游戏服务中从com.android.support:support-v4:26.1.0得到同样的东西。可能导致此错误的原因是什么?

2 个答案:

答案 0 :(得分:26)

该行

+--- com.android.support:customtabs:26.1.0

在它的末尾没有-> 27.1.1,这意味着它没有自动升级到27.1.1(它显示在传递依赖项下,因为那些传递依赖自动升级)。

您可以通过手动将该依赖项添加到27.1.1文件来强制它使用build.gradle版本:

implementation 'com.android.support:customtabs:27.1.1'

答案 1 :(得分:1)

您可以在app.iml文件中搜索不匹配的版本号(26.1.0),并可以在app level build.gradle中添加这些依赖项,强制使用最新版本(本例中为27.1.1)