欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

查看 gradle依赖关系,以及去除重复依赖包

程序员文章站 2022-06-15 09:38:28
1、如何查看 as 中 包之间的依赖关系可以得到类似以下层级依赖关系------------------------------------------------------------Project :appdebugAndroidTestCompileClasspath - Resolved configuration for compilation for variant: debugAndroidTest+--- com.android.support.test.espresso:es...

1、如何查看 as 中 包之间的依赖关系

查看 gradle依赖关系,以及去除重复依赖包
可以得到类似以下层级依赖关系

------------------------------------------------------------
Project :app
debugAndroidTestCompileClasspath - Resolved configuration for compilation for variant: debugAndroidTest
+--- com.android.support.test.espresso:espresso-core:2.2.2
|    +--- com.squareup:javawriter:2.1.1
|    +--- com.android.support.test:rules:0.5
|    |    \--- com.android.support.test:runner:0.5
|    |         +--- junit:junit:4.12
|    |         |    \--- org.hamcrest:hamcrest-core:1.3
|    |         \--- com.android.support.test:exposed-instrumentation-api-publish:0.5
|    +--- com.android.support.test:runner:0.5 (*)
|    +--- javax.inject:javax.inject:1
|    +--- org.hamcrest:hamcrest-library:1.3
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- com.android.support.test.espresso:espresso-idling-resource:2.2.2
|    +--- org.hamcrest:hamcrest-integration:1.3
|    |    \--- org.hamcrest:hamcrest-library:1.3 (*)
|    +--- com.google.code.findbugs:jsr305:2.0.1
|    \--- javax.annotation:javax.annotation-api:1.2
+--- com.tencent.tbs.tbssdk:sdk:43697
+--- project :liveplayer-sdk-ui
|    +--- com.android.databinding:baseLibrary:3.2.0
|    +--- com.android.databinding:library:3.2.0
|    |    +--- android.arch.lifecycle:runtime:1.0.3 -> 1.1.1
|    |    |    +--- android.arch.lifecycle:common:1.1.1
|    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    +--- android.arch.core:common:1.1.1
|    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    +--- com.android.support:support-core-utils:26.1.0 -> 28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:collections:28.0.0
|    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- android.arch.lifecycle:runtime:1.1.1 (*)
|    |    |    |    \--- com.android.support:versionedparcelable:28.0.0
|    |    |    |         +--- com.android.support:support-annotations:28.0.0
|    |    |    |         \--- com.android.support:collections:28.0.0 (*)
|    |    |    +--- com.android.support:documentfile:28.0.0
|    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:loader:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    +--- android.arch.lifecycle:livedata:1.1.1
|    |    |    |    |    +--- android.arch.core:runtime:1.1.1
|    |    |    |    |    |    +--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    |    |    |    \--- android.arch.core:common:1.1.1 (*)
|    |    |    |    |    +--- android.arch.lifecycle:livedata-core:1.1.1
|    |    |    |    |    |    +--- android.arch.lifecycle:common:1.1.1 (*)
|    |    |    |    |    |    +--- android.arch.core:common:1.1.1 (*)
|    |    |    |    |    |    \--- android.arch.core:runtime:1.1.1 (*)
|    |    |    |    |    \--- android.arch.core:common:1.1.1 (*)
|    |    |    |    \--- android.arch.lifecycle:viewmodel:1.1.1
|    |    |    |         \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    +--- com.android.support:localbroadcastmanager:28.0.0
|    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    \--- com.android.support:print:28.0.0
|    |    |         \--- com.android.support:support-annotations:28.0.0
|    |    \--- com.android.databinding:baseLibrary:3.2.0
|    \--- com.android.databinding:adapters:3.2.0
|         +--- com.android.databinding:baseLibrary:3.2.0
|         \--- com.android.databinding:library:3.2.0 (*)
+--- com.android.support:design:28.0.0
|    +--- com.android.support:support-annotations:28.0.0
|    +--- com.android.support:support-compat:28.0.0 (*)
|    +--- com.android.support:support-core-ui:28.0.0
|    |    +--- com.android.support:support-annotations:28.0.0
|    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    +--- com.android.support:support-core-utils:28.0.0 (*)
|    |    +--- com.android.support:customview:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    \--- com.android.support:support-compat:28.0.0 (*)
|    |    +--- com.android.support:viewpager:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    +--- com.android.support:coordinatorlayout:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    +--- com.android.support:drawerlayout:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    +--- com.android.support:slidingpanelayout:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    +--- com.android.support:interpolator:28.0.0
|    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    +--- com.android.support:swiperefreshlayout:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    \--- com.android.support:interpolator:28.0.0 (*)
|    |    +--- com.android.support:asynclayoutinflater:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    \--- com.android.support:support-compat:28.0.0 (*)
|    |    \--- com.android.support:cursoradapter:28.0.0
|    |         \--- com.android.support:support-annotations:28.0.0
|    +--- com.android.support:support-core-utils:28.0.0 (*)
|    +--- com.android.support:support-fragment:28.0.0
|    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    +--- com.android.support:support-core-ui:28.0.0 (*)
|    |    +--- com.android.support:support-core-utils:28.0.0 (*)
|    |    +--- com.android.support:support-annotations:28.0.0
|    |    +--- com.android.support:loader:28.0.0 (*)
|    |    \--- android.arch.lifecycle:viewmodel:1.1.1 (*)
|    +--- com.android.support:transition:28.0.0
|    |    +--- com.android.support:support-annotations:28.0.0
|    |    \--- com.android.support:support-compat:28.0.0 (*)
|    +--- com.android.support:appcompat-v7:28.0.0
|    |    +--- com.android.support:support-annotations:28.0.0
|    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    +--- com.android.support:collections:28.0.0 (*)
|    |    +--- com.android.support:cursoradapter:28.0.0 (*)
|    |    +--- com.android.support:support-core-utils:28.0.0 (*)
|    |    +--- com.android.support:support-fragment:28.0.0 (*)
|    |    +--- com.android.support:support-vector-drawable:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    \--- com.android.support:support-compat:28.0.0 (*)
|    |    \--- com.android.support:animated-vector-drawable:28.0.0
|    |         +--- com.android.support:support-vector-drawable:28.0.0 (*)
|    |         \--- com.android.support:support-core-ui:28.0.0 (*)
|    +--- com.android.support:cardview-v7:28.0.0
|    |    \--- com.android.support:support-annotations:28.0.0
|    \--- com.android.support:recyclerview-v7:28.0.0
|         +--- com.android.support:support-annotations:28.0.0
|         +--- com.android.support:support-compat:28.0.0 (*)
|         \--- com.android.support:support-core-ui:28.0.0 (*)
+--- com.android.support:appcompat-v7:26.+ -> 28.0.0 (*)
+--- com.android.support:cardview-v7:26.+ -> 28.0.0 (*)
+--- com.squareup.retrofit2:retrofit:2.1.0
|    \--- com.squareup.okhttp3:okhttp:3.3.0 -> 3.4.1
|         \--- com.squareup.okio:okio:1.9.0
+--- com.squareup.retrofit2:converter-gson:2.1.0
|    +--- com.squareup.retrofit2:retrofit:2.1.0 (*)
|    \--- com.google.code.gson:gson:2.7
+--- com.squareup.retrofit2:adapter-rxjava:2.1.0
|    +--- com.squareup.retrofit2:retrofit:2.1.0 (*)
|    \--- io.reactivex:rxjava:1.1.5 -> 1.3.0
+--- com.squareup.okhttp3:logging-interceptor:3.4.1
|    \--- com.squareup.okhttp3:okhttp:3.4.1 (*)
+--- com.github.bumptech.glide:glide:4.8.0
|    +--- com.github.bumptech.glide:gifdecoder:4.8.0
|    |    \--- com.android.support:support-annotations:27.1.1 -> 28.0.0
|    +--- com.github.bumptech.glide:disklrucache:4.8.0
|    +--- com.github.bumptech.glide:annotations:4.8.0
|    \--- com.android.support:support-fragment:27.1.1 -> 28.0.0 (*)
+--- io.reactivex:rxandroid:1.2.1
|    \--- io.reactivex:rxjava:1.1.6 -> 1.3.0
+--- io.reactivex:rxjava:1.3.0
+--- org.greenrobot:eventbus:3.0.0
+--- me.everything:overscroll-decor-android:1.0.4
|    \--- com.android.support:recyclerview-v7:23.3.0 -> 28.0.0 (*)
+--- me.leolin:ShortcutBadger:1.1.18 -> 1.1.22
+--- :openDefault-4.3.0
+--- com.umeng.sdk:push:4.2.0
+--- com.android.support:multidex:1.0.3
+--- pub.devrel:easypermissions:0.4.3
|    \--- com.android.support:appcompat-v7:25.3.1 -> 28.0.0 (*)
+--- com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-26
+--- com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-26
+--- com.umeng.umsdk:analytics:8.0.0
+--- com.umeng.umsdk:common:2.0.0
+--- com.github.franmontiel:PersistentCookieJar:v1.0.1
|    \--- com.squareup.okhttp3:okhttp:3.1.2 -> 3.4.1 (*)
+--- com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.6
+--- com.davemorrissey.labs:subsampling-scale-image-view:3.5.0
|    \--- com.android.support:support-annotations:20.0.0 -> 28.0.0
+--- com.contrarywind:Android-PickerView:3.2.4
+--- me.leolin:ShortcutBadger:1.1.22
+--- com.github.devlight.shadowlayout:library:1.0.2
|    +--- org.jsoup:jsoup:+ -> 1.13.1
|    \--- com.android.support:appcompat-v7:23.3.0 -> 28.0.0 (*)
+--- project :gallery
+--- project :banner
+--- project :imagepagerlib
+--- project :imageslibrary
+--- com.github.heynchy:CompressImage:v0.1.2
+--- jp.wasabeef:glide-transformations:2.0.1
|    \--- com.github.bumptech.glide:glide:3.7.0 -> 4.8.0 (*)
+--- com.yanzhenjie:sofia:1.0.5
+--- com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.40
+--- project :citypicker
+--- com.jude:easyrecyclerview:4.4.2
+--- com.github.hackware1993:MagicIndicator:1.5.0
|    \--- com.android.support:appcompat-v7:23.4.0 -> 28.0.0 (*)
\--- com.android.support:support-annotations:27.1.1 -> 28.0.0

2、去除重复依赖包

在 build.gradle 文件中,使用 exclude

dependencies{
          implementation('com.afollestad.material-dialogs:commons:0.9.4.5') {
                 exclude group: 'com.android.support'
           }
}

具体情况可以具体分析

另附上一篇文章:

Android Gradle依赖管理、去除重复依赖、忽略的方式

本文地址:https://blog.csdn.net/xzytl60937234/article/details/107406331

相关标签: --------【Android】