我的应用程序中有四个库如下:
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
有额外的依赖[见图片]:
程序兼容性-V7
Library stats - click for more information
com.android.support:appcompat-v7:25.2.0 [5705]
Dependencies (some might be shared with other libraries): [13458]
com.android.support:animated-vector-drawable:25.2.0 [183]
com.android.support:support-annotations:25.2.0 [32]
com.android.support:support-compat:25.2.0 [6564]
com.android.support:support-core-ui:25.2.0 [1992]
com.android.support:support-core-utils:25.2.0 [929]
com.android.support:support-fragment:25.2.0 [1377]
com.android.support:support-media-compat:25.2.0 [1983]
com.android.support:support-v4:25.2.0 [2]
com.android.support:support-vector-drawable:25.2.0 [396]
设计支持库:
Library stats - click for more information
com.android.support:design:25.2.0 [2749]
Dependencies (some might be shared with other libraries): [22434]
com.android.support:animated-vector-drawable:25.2.0 [183]
com.android.support:appcompat-v7:25.2.0 [5705]
com.android.support:recyclerview-v7:25.2.0 [2405]
com.android.support:support-annotations:25.2.0 [32]
com.android.support:support-compat:25.2.0 [6564]
com.android.support:support-core-ui:25.2.0 [1992]
com.android.support:support-core-utils:25.2.0 [929]
com.android.support:support-fragment:25.2.0 [1377]
com.android.support:support-media-compat:25.2.0 [1983]
com.android.support:support-v4:25.2.0 [2]
com.android.support:support-vector-drawable:25.2.0 [396]
com.android.support:transition:25.2.0 [866]
问题:
提前谢谢。
答案 0 :(得分:1)
当我们考虑apk的大小时,是否需要排除常见的依赖关系?
Gradle为你做到了。它不会两次添加相同的依赖项。
如果设计支持库有appcompat-v7则需要添加appcompat-v7吗?
不,添加设计库就足够了 Gradle将为您下载所有嵌套依赖项,然后是appcompat-v7库。