本文介绍了错误:多个库包名“com.google.android.gms”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用过Android Studio 0.8.2,并创建了一个项目与Android 4.1和Android 4.4磨损。我需要将它与谷歌播放服务进行集成。

I'm using Android Studio 0.8.2, and created a project with Android 4.1 and Android Wear 4.4. I need to integrate it with Google Play Services.

我想在这里请按照Android Studio中的谷歌播放服务设置页面:
https://developer.android.com/google/play-services/setup.html

I'm trying to follow the Google Play Services setup page for Android Studio here:https://developer.android.com/google/play-services/setup.html

在步骤2中,它说,添加这种依赖性:

In Step 2, it says to add this dependency:

compile 'com.google.android.gms:play-services:5.0.77'

然而,在同步,我得到这个消息:

However, upon Sync, I get this message:

Error:Execution failed for task ':mobile: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

下面是移动模块内我的完整的build.gradle文件:

Here is my complete build.gradle file inside the mobile module:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.OptimizedPrime.locationweartabs"
        minSdkVersion 16
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    compile 'com.google.android.gms:play-services-wearable:+'
    compile 'com.google.android.gms:play-services:5.0.77'
    // You must install or update the Support Repository through the SDK manager to use this dependency.
    compile 'com.android.support:support-v13:19.+'
}

看来,推荐的依赖与耐磨编译语句冲突。我也想保留耐磨的支持,同时需要谷歌播放服务。我该如何解决这个问题?

It appears that the recommended dependency is conflicting with the wearable compile statement. I do want to retain wearable support, and at the same time need Google Play Services. How do I fix this?

推荐答案

如果您有:

compile 'com.google.android.gms:play-services-wearable:5.0.77'

那么你并不需要:

then you don't need:

compile 'com.google.android.gms:play-services:5.0.77'

删除无耐磨之一。

Delete the non-wearable one.

这篇关于错误:多个库包名“com.google.android.gms”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 22:18