gpt4 book ai didi

android - Gradle 库冲突

转载 作者:行者123 更新时间:2023-12-03 06:11:44 25 4
gpt4 key购买 nike

我的项目中有一个模块依赖项。此依赖项包含旧版本的 google 服务。但我的主要项目包括最新的一个。结果我在构建项目时遇到异常:

Error:(93, 17) error: cannot find symbol method getMapAsync(<anonymous OnMapReadyCallback>)

Gradle 似乎尝试使用旧版本的 google services api。如何在最终项目中排除这个库?我听说过传递依赖。这是解决这个问题的正确方法吗?

最佳答案

这是您可以排除传递依赖的方式:

configurations {
compile.exclude module: 'commons'
all*.exclude group: 'org.gradle.test.excludes', module: 'reports'
}

dependencies {
compile("org.gradle.test.excludes:api:1.0") {
exclude module: 'shared'
}
}

https://docs.gradle.org/current/userguide/dependency_management.html

如果您不想排除依赖项,也可以使用 resolutionStratgy跨项目强制使用版本号

https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

关于android - Gradle 库冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34137973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com