2
votes

My Gradle dependencies includes:

compile'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0

I am getting BUILD FAILED with error:

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

How can I solve this problem?

3

3 Answers

2
votes

Use gradle androidDependencies to learn where the duplicate Google Play Services is coming from. Then use exclude to filter the duplicates out in your Gradle dependencies, e.g.

compile('something.that.includes.google.play.services:1.2.3') {
    exclude group: 'com.google.android.gms'
}
2
votes

I had the same problem and I solved by adding this line android.enforceUniquePackageName = false in build.gradle(app) like this:

buildTypes {
    release {
        ...
       ... ...
    }
} 
android.enforceUniquePackageName = false
-2
votes

The easiest way is to replace these dependencies by the whole package :

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

Then you could probably compile it.

OR add android.enforceUniquePackageName = false in your build.gradle.

android {

    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        versionCode Integer.parseInt(project.VERSION_CODE)
        versionName project.VERSION_NAME
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    android.packageBuildConfig = false
    android.enforceUniquePackageName = false

}