Android 查看項目依賴樹的四種方式:
-
方式一:
./gradlew 模塊名:dependencies //查看單獨模塊的依賴 ./gradlew :app:dependencies --configuration compile //查看項目的編譯依賴
-
方式二:使用Gradle Project
-
方式三:安裝Android Studio插件
gradle view

-
方式四:如果你嫌在命令行窗口展示觀看不友好,這里還有一種體驗更好的方式。
輸入下面命令行:
./gradlew build --scan
出現如下:
Publishing a build scan to scans.gradle.com requires accepting the Terms of Service defined at https://scans.gradle.com/terms-of-service. Do you accept these terms? [yes, no]
輸入yes同意,將會出現一個網頁地址,登錄該網址
該網頁還提供沖突提示,列出了引用了此類庫的類庫,效果如下:

小結
1.方式一和方式二實際上是同一種方法,可以進行搜索查找
2.方式三插件的方式省去了輸入指令的繁瑣,弊端是無法進行全局搜索
3.方式四顯示較為美觀 可以快速定位沖突的依賴
關於我
微信公眾號:infree6 或者直接掃碼