【问题标题】:Exclude sub module of com.google.gms排除 com.google.gms 的子模块
【发布时间】:2017-12-20 07:37:32
【问题描述】:

这是我的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 的子模块?任何帮助或建议将不胜感激。

【问题讨论】:

    标签: android gradle google-play-services


    【解决方案1】:

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

    尝试在所有配置上完全排除它

    configurations.all.exclude group: 'com.android.support', module: 'support-v4'
    

    【讨论】:

    • 它可以工作,但它也删除了com.android.support:appcompat-v7 中的support-v4(我不想要)。你有什么想法吗?
    • 当然可以。您是否排除了该库。你不能排除包含一个库。除了可能通过编写一些自定义类加载器。
    猜你喜欢
    • 2020-01-13
    • 1970-01-01
    • 2016-01-29
    • 1970-01-01
    • 2016-01-09
    • 2011-06-20
    • 1970-01-01
    • 2017-01-25
    • 2019-02-12
    相关资源
    最近更新 更多