排除com.google.gms的子模块

时间:2017-12-20 07:37:33

标签: android gradle google-play-services

这是我的com.google.android.gms模块

+--- com.google.android.gms:play-services-location:11.0.1
|    +--- com.google.android.gms:play-services-base:[11.0.1] -> 11.0.1
|    |    \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1
|    |         \--- com.google.android.gms:play-services-basement:[11.0.1] -> 11.0.1
|    |              \--- com.android.support:support-v4:25.2.0
|    |                   +--- com.android.support:support-compat:25.2.0
|    |                   |    \--- com.android.support:support-annotations:25.2.0
|    |                   +--- com.android.support:support-media-compat:25.2.0
|    |                   |    +--- com.android.support:support-annotations:25.2.0
|    |                   |    \--- com.android.support:support-compat:25.2.0 (*)
|    |                   +--- com.android.support:support-core-utils:25.2.0
|    |                   |    +--- com.android.support:support-annotations:25.2.0
|    |                   |    \--- com.android.support:support-compat:25.2.0 (*)
|    |                   +--- com.android.support:support-core-ui:25.2.0
|    |                   |    +--- com.android.support:support-annotations:25.2.0
|    |                   |    \--- com.android.support:support-compat:25.2.0 (*)
|    |                   \--- com.android.support:support-fragment:25.2.0
|    |                        +--- com.android.support:support-compat:25.2.0 (*)
|    |                        +--- com.android.support:support-media-compat:25.2.0 (*)
|    |                        +--- com.android.support:support-core-ui:25.2.0 (*)
|    |                        \--- com.android.support:support-core-utils:25.2.0 (*)
|    \--- com.google.android.gms:play-services-tasks:[11.0.1] -> 11.0.1 (*)

目前,我想排除com.android.support:support-v4:25.2.0(因为它有一些Fragment的错误)所以我喜欢

compile ('com.google.android.gms:play-services-location:11.0.1'){
    exclude group: 'com.android.support', module: 'support-v4'
}

然而,它不起作用。我在apply plugin: 'com.google.gms.google-services'找到了一个线索。当我删除apply plugin: 'com.google.gms.google-services'时,请排除工作。

如何排除com.google.gms的子模块?任何帮助或建议都将非常感激。

1 个答案:

答案 0 :(得分:2)

它认为问题在于您只将其排除在该单个依赖项的传递依赖项中。

尝试在所有配置(例如

)上完全排除它
configurations.all.exclude group: 'com.android.support', module: 'support-v4'