android - Google Map V2 和 GCM 在一个项目中

标签 android android-studio gradle google-cloud-messaging google-play-services

我有一个使用 Google Map API v2 的项目,现在我想将 GCM 添加到这个项目,当我将 GCM 依赖项添加到我的 gradle 文件时,我遇到了这个错误:

Error:Execution failed for task ':app:processDebugResources'. Error: more than one library with package name 'com.google.android.gms' You can temporarily disable this error with android.enforceUniquePackageName=false However, this is temporary and will be enforced in 1.0

我的依赖项是:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.github.rey5137:material:1.2.1'
compile ('com.google.android.gms:play-services:4.1.32')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile('com.balysv.materialmenu:material-menu:1.5.4') {
    exclude group: 'com.nineoldandroids', module: 'library'
}
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:21.0.3'

我能做什么?

最佳答案

compile ('com.google.android.gms:play-services:4.1.32')
compile 'com.google.android.gms:play-services-gcm:7.8.0'

请不要使用两个不同版本的 Google Play 服务。

此外,最重要的是尝试使用应用程序所需的那些 gradle 依赖项而不是所有依赖项。检查here

关于android - Google Map V2 和 GCM 在一个项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35986841/

相关文章:

java - 在android中使用camera2拍照

java - 构建 apk(libgdx) 时 android studio 出错

android - "The signing configuration should be specified in Gradle build scripts"...我做到了

android - 如何在 Android Studio 中使用最新的 gradle 版本

android - OpenCV Native Android cvtColor 崩溃

android - 你如何反编译,在eclipse中编辑并重新编译一个apk?一步步?

android - 获取使用 GestureDetector 触摸的 View

Android Studio 找不到 AndroidJUnit4.class + 测试失败

android - 关于Android studio中gms-play-services appindexing更新到10.2.0

error-handling - .execute()命令失败时,失败Gradle TaskAction