我的项目中有一个模块依赖项。此依赖项包含旧版本的google服务。但我的主要项目包括最新的一个。因此,我在构建项目时出现异常:
Error:(93, 17) error: cannot find symbol method getMapAsync(<anonymous OnMapReadyCallback>)看起来Gradle试图使用旧版本的google服务api。如何在最终项目中排除此库?我听说过传递依赖。这是解决这个问题的正确方法吗?
发布于 2015-12-08 04:15:24
下面是排除可传递依赖项的方法:
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
https://stackoverflow.com/questions/34137973
复制相似问题