我正在尝试删除所有重复项以将其限制在64K以内(现在我有65239,这不好,因为在这种情况下,我需要使用multidex,这需要另一个依赖项),但是我找不到有关如何从子组中删除模块的任何信息。
例如,com.android.support:support-v4:26.1.0
下的几乎每个子依赖项都具有com.android.support:support-compat:26.1.0
,我需要删除它,因为com.android.support:support-v4:26.1.0
的根中已经有一个,并且我需要保留这个。
//更新: 以下线程gradle - library duplicates in dependencies讨论了一个不同的问题,该问题涉及不同版本的依赖项。我没有这个问题,我使用的所有依赖项都有我需要的版本。
我需要删除所有标有(*)
的模块
+--- com.android.support:appcompat-v7:26.1.0
| +--- com.android.support:support-annotations:26.1.0
| +--- com.android.support:support-v4:26.1.0
| | +--- com.android.support:support-compat:26.1.0
| | | +--- com.android.support:support-annotations:26.1.0
| | | \--- android.arch.lifecycle:runtime:1.0.0 -> 1.0.3
| | | +--- android.arch.lifecycle:common:1.0.3
| | | | \--- com.android.support:support-annotations:26.1.0
| | | +--- android.arch.core:common:1.0.0
| | | | \--- com.android.support:support-annotations:26.1.0
| | | \--- com.android.support:support-annotations:26.1.0
| | +--- com.android.support:support-media-compat:26.1.0
| | | +--- com.android.support:support-annotations:26.1.0
| | | \--- com.android.support:support-compat:26.1.0 (*)
| | +--- com.android.support:support-core-utils:26.1.0
| | | +--- com.android.support:support-annotations:26.1.0
| | | \--- com.android.support:support-compat:26.1.0 (*)
| | +--- com.android.support:support-core-ui:26.1.0
| | | +--- com.android.support:support-annotations:26.1.0
| | | \--- com.android.support:support-compat:26.1.0 (*)
| | \--- com.android.support:support-fragment:26.1.0
| | +--- com.android.support:support-compat:26.1.0 (*)
| | +--- com.android.support:support-core-ui:26.1.0 (*)
| | \--- com.android.support:support-core-utils:26.1.0 (*)
| +--- com.android.support:support-vector-drawable:26.1.0
| | +--- com.android.support:support-annotations:26.1.0
| | \--- com.android.support:support-compat:26.1.0 (*)
| \--- com.android.support:animated-vector-drawable:26.1.0
| +--- com.android.support:support-vector-drawable:26.1.0 (*)
| \--- com.android.support:support-core-ui:26.1.0 (*)
+--- com.android.support:recyclerview-v7:26.1.0
| +--- com.android.support:support-annotations:26.1.0
| +--- com.android.support:support-compat:26.1.0 (*)
| \--- com.android.support:support-core-ui:26.1.0 (*)
+--- com.android.support:design:26.1.0
| +--- com.android.support:support-v4:26.1.0 (*)
| +--- com.android.support:appcompat-v7:26.1.0 (*)
| +--- com.android.support:recyclerview-v7:26.1.0 (*)
| \--- com.android.support:transition:26.1.0
| +--- com.android.support:support-annotations:26.1.0
| \--- com.android.support:support-v4:26.1.0 (*)
+--- com.google.guava:guava:23.3-android
| +--- com.google.code.findbugs:jsr305:1.3.9
| +--- com.google.errorprone:error_prone_annotations:2.0.18
| +--- com.google.j2objc:j2objc-annotations:1.1
| \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
+--- com.jakewharton:butterknife:8.8.1
| +--- com.jakewharton:butterknife-annotations:8.8.1
| | \--- com.android.support:support-annotations:25.3.0 -> 26.1.0
| \--- com.android.support:support-annotations:25.3.0 -> 26.1.0
+--- android.arch.persistence.room:runtime:1.0.0-rc1
| +--- android.arch.persistence.room:common:1.0.0-rc1
| +--- android.arch.persistence:db-framework:1.0.0-rc1
| | \--- android.arch.persistence:db:1.0.0-rc1
| +--- android.arch.persistence:db:1.0.0-rc1
| \--- android.arch.core:runtime:1.0.0-rc1
| \--- android.arch.core:common:1.0.0 (*)
+--- android.arch.lifecycle:extensions:1.0.0-rc1
| \--- android.arch.lifecycle:runtime:1.0.3 (*)
\--- project :library
我的gradle依赖项:
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation ('com.android.support:recyclerview-v7:26.1.0') {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-core-ui'
}
implementation 'com.android.support:design:26.1.0'
implementation ('com.google.guava:guava:23.3-android')
implementation ('com.jakewharton:butterknife:8.8.1') {
exclude group: 'com.android.support', module: 'support-compat'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0-rc1'
annotationProcessor 'android.arch.lifecycle:common-java8:1.0.0-rc1'
implementation ('android.arch.persistence.room:runtime:1.0.0-rc1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-core-utils'
}
implementation ('android.arch.lifecycle:extensions:1.0.0-rc1') {
exclude group: 'android.arch.lifecycle:', module: 'runtime'
exclude group: 'android.arch.core', module: 'common'
exclude group: 'android.arch.core', module: 'runtime'
exclude group: 'com.android.support', module: 'support-fragment'
exclude group: 'android.arch.lifecycle', module: 'common'
}
testImplementation ('junit:junit:4.12')
testImplementation 'org.mockito:mockito-core:2.11.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
androidTestImplementation 'android.arch.persistence.room:testing:1.0.0-rc1'
testImplementation 'android.arch.core:core-testing:1.0.0-rc1'
implementation (project(':library')) {
exclude group: 'com.google.guava', module:'guava'
exclude group: 'junit', module: 'junit'
}