Android 格雷德尔图书馆冲突

Android 格雷德尔图书馆冲突,android,android-studio,gradle,module,Android,Android Studio,Gradle,Module,我的项目中有一个模块依赖项。此依赖项包含旧版本的google服务。但我的主要项目包括最新的一个。因此,我在构建项目时遇到异常: Error:(93, 17) error: cannot find symbol method getMapAsync(<anonymous OnMapReadyCallback>) 错误:(93,17)错误:找不到符号方法getMapAsync() Gradle似乎试图使用谷歌服务api的旧版本。如何在最终项目中排除此库?我听说过传递依赖关系。这是解决

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

Error:(93, 17) error: cannot find symbol method getMapAsync(<anonymous OnMapReadyCallback>)
错误:(93,17)错误:找不到符号方法getMapAsync()

Gradle似乎试图使用谷歌服务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'
  }
}

如果不想排除依赖关系,还可以使用
解决方案策略
在项目之间强制输入版本号