Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: more than one library with package name 'com.google.android.gms'

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.

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

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

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?

like image 635
Gerard Avatar asked Jul 17 '14 04:07

Gerard


1 Answers

If you have:

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.

like image 132
Scott Barta Avatar answered Oct 12 '22 12:10

Scott Barta