我有一个使用 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/