Zahidul
Zahidul

Reputation: 399

Android error when adding plugin com.google.gms.google-services

I am working with Firebase in my Android project. When I add

apply plugin: 'com.google.gms.google-services'

in gradle, it gives me an error. logcat says:

Error:Execution failed for task ':app:mergeDebugResources'.
> [string/google_api_key] E:\android\Workspace\FireGuard\app\src\main\res\values\strings.xml    [string/google_api_key] E:\android\Workspace\FireGuard\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources

I searched a lot, but no luck. How to remove this error? Please help.

below is my gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "25.0.0"

defaultConfig {
    applicationId "com.example.pc.fireguard"
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}

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

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
}
dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',

{

exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:24.2.1'

testCompile 'junit:junit:4.12'

compile 'com.android.volley:volley:1.0.0'

compile 'com.mikhaellopez:circularimageview:3.0.2'

compile 'com.android.support:support-v13:24.0.0'

compile 'com.android.support:recyclerview-v7:24.0.0'

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

compile project(':date4j')

compile project(':simple-crop-image-lib')

compile 'com.squareup.picasso:picasso:2.3.2'

compile project(':httpclient-4.3.4')

compile project(':httpmime-4.3.4')

compile project(':httpcore-4.3.2')

compile 'com.paypal.sdk:paypal-android-sdk:2.15.1'

}

apply plugin: 'com.google.gms.google-services'

Upvotes: 0

Views: 389

Answers (1)

Paresh Mayani
Paresh Mayani

Reputation: 128448

Strings.xml in your app is having same name as of values.xml of google services library!

Since this answer has helped you in sorting out the issue, I am posting the same comment as an answer.

Upvotes: 1

Related Questions