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

问题描述

我使用的是 Android Studio 0.8.2,并使用 Android 4.1 和 Android Wear 4.4 创建了一个项目.我需要将它与 Google Play 服务集成.

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 的 Google Play 服务设置页面进行操作: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.+'
}

似乎推荐的依赖项与可穿戴编译语句相冲突.我确实想保留可穿戴设备支持,同时需要 Google Play 服务.我该如何解决这个问题?

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'

那么你不需要:

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

删除不可穿戴的.

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

09-02 23:09