查看 android dependecise

Aside of using Project view -> External Libraries, I use gradle command to output the dependencies into a txt file for searching. Use ./gradlew On Mac and gradlew.bat on Window.

$ ./gradlew -q :app:dependencies > dependencies.txt

In dependencies.txt, use "Find" and type "design", for example, and look at all highlighted libraries and their version number. From some SO posts, they suggest to exclude duplicated dependencies. If a dependency is included by another one (for example, com.android.support:cardview-v7 is included by com.firebaseui:firebase-ui-auth), we can omit that dependency from the app/build.gradle.

I fixed my project by removing these dependencies from my gradle:

implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-vector-drawable:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'

I keep this one (and upgrade from 27.0.2 to 27.1.0):

implementation 'com.android.support:design:27.1.0'

Add exclude to following dependencies:

implementation 'com.firebaseui:firebase-ui-auth:3.1.2', {
    exclude group: 'android.arch.lifecycle', module: 'extensions'
    exclude group: 'com.android.support', module: 'design'
}
implementation 'com.romandanylyk:pageindicatorview:1.0.0', {
    exclude group: 'com.android.support', module: 'support-core-ui'
}

I got into the lifecycle issue after add/remove dependencies. Another SO post suggest that two different version of library was included. So, I updated the output file in step 1 and check:

+--- 'com.google.firebase:firebase-core:11.8.0'
|    +--- 'android.arch.lifecycle:runtime:1.1.0' 

+--- 'com.firebaseui:firebase-ui-auth:3.1.2'
|    +--- 'android.arch.lifecycle:extensions:1.0.0'

By excluding android.arch.lifecycle:extensions that solve the compile problem.

shareimprove this answer

edited Mar 14 at 8:35

answered Mar 14 at 8:30

John Pang

1,1721219

add a comment

up vote2down vote

Run this to view app dependencies

gradlew -q :app:dependencies > dependencies.txt

It will output a big tree, where:

  • (*) is used to indicate that particular dependency is described somewhere else in the tree
  • -> (arrow) is used to point the dependency that wins in version conflict. By default, gradle chooses the newest version.

Output:

+--- com.android.support:design:26.1.0
|    +--- com.android.support:support-v4:26.1.0 (*)
|    +--- com.android.support:appcompat-v7:26.1.0 -> 27.1.1 (*)
|    +--- com.android.support:recyclerview-v7:26.1.0 (*)
|    \--- com.android.support:transition:26.1.0
|         +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
|         \--- com.android.support:support-v4:26.1.0 (*)

In my case I found that com.android.support:design:26.1.0 was depending on com.android.support:appcompat-v7:26.1.0 -> 27.1.1 (*), which resolved to 27.1.1 instead of 26.1.0

Solution Force version 26.1.0 by declaring in gradle compile ("com.android.support:appcompat-v7:26.1.0") { force = true }

References


From: https://stackoverflow.com/questions/49044782/duplicate-zip-entry-classes-jarandroid-support-design-widget-coordinatorlayout

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值