android studio 查看gradlew dependence

第一种方法

在terminal里输入

/gradlew app:dependencies

通过依赖树具体排查, 找到问题根源,排除掉

./gradlew dependencies -q --configuration compile

其中app换成你想要看依赖的module的名称


第二种方法

在工程的build.gradle中追加这段代码

subprojects {
    task allDeps(type: DependencyReportTask) {}
}


然后再terminal里输入

gradlew allDeps


+, -, | and \ are just used to draw the tree - it's a kind of ASCII art.

When it comes to (*) and -> please refer to this question and answer.

tl;dr

(*) - is used to indicate that particular dependency is described somewhere else in the tree

-> - is used to point the dependency that wins in version conflict.


或者在setting里面下载 gradle view的插件。在重启studio后
android studio 界面中点击菜单view - Tool Window -Gradle View,开启Gradle View, 视图窗口左上角又刷新按钮。




 +--- project :photoAlbum            
 |    +--- com.android.support:support-v4:22.2.1 ->23.1.1
 |    +--- com.actionbarsherlock:actionbarsherlock:4.4.0
 |    +--- pl.droidsonroids.gif:android-gif-drawable:1.1.7
 |    +--- com.qiniu:qiniu-android-sdk:7.0.6
 |    |    \--- com.loopj.android:android-async-http:1.4.6 -> 1.4.7
 |    +--- com.nostra13.universalimageloader:universal-image-loader:1.9.1
 |    +--- com.loopj.android:android-async-http:1.4.7
 |    +--- com.umeng.analytics:analytics:5.4.2
 |    +--- com.facebook.fresco:fresco:0.10.0
 |    |    +--- com.facebook.fresco:drawee:0.10.0
 |    |    |    \--- com.android.support:support-v4:23.1.1(*)
 |    |    |    | --- com.facebook.fresco:fbcore:0.10.0
 |    |    +--- com.facebook.fresco:fbcore:0.10.0
 |    |    \--- com.facebook.fresco:imagepipeline:0.10.0
 |    |         +--- com.android.support:support-v4:23.1.1 (*)
 |    |         +--- com.nineoldandroids:library:2.4.0
 |    |         +--- com.facebook.fresco:fbcore:0.10.0
 |    |         +--- com.facebook.fresco:imagepipeline-base:0.10.0
 |    |         |    +--- com.nineoldandroids:library:2.4.0
 |    |         |    +--- com.facebook.fresco:fbcore:0.10.0
 |    |         |    \--- com.parse.bolts:bolts-android:1.1.4
 |    |         \--- com.parse.bolts:bolts-android:1.1.4



仔细观察你会发现有些传递依赖标注了*号,表示这个依赖被忽略了,这是因为其他顶级依赖中也依赖了这个传递的依赖,Gradle会自动分析下载最合适的依赖。有些依赖形如22.2.1 ->23.1.1是由于默认会优先版本高的依赖.这个时候你想使用版本低的依赖的话需要排除掉高的依赖。因此这里需要排除Fresco里面的supportV4依赖。

 compile('com.facebook.fresco:fresco:0.10.0') {
       exclude module: 'support-v4'
 }



你可能感兴趣的:(android studio 查看gradlew dependence)