user1324936
user1324936

Reputation: 2187

Gradle conflict play-services:4.0.30 with GoogleAdMobAdsSdk

I am using Android Studio 0.3.4 with Gradle build. I get this error message when I build my project:

Gradle: Execution failed for task > Could not call IncrementalTask.taskAction()

This is because google play services and GoogleAdMobAdsSdk-6.4.1 are conflictiing. My build.gradle has this entry:

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v13:13.0.0'
    compile 'com.google.android.gms:play-services:4.0.30'
    compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')

When I remove GoogleAdMobAdsSdk then it builds fine. How can I solve this problem?

this is the error:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/google/ads/AdRequest$Err
orCode;
        at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:12
3)

thanks

Upvotes: 4

Views: 1747

Answers (1)

Jake Andreu
Jake Andreu

Reputation: 367

Google Mobile Ads SDK for Android is now included as part of Google Play services 4.0. More info http://googleadsdeveloper.blogspot.com.es/2013/10/upgrade-to-new-google-mobile-ads-sdk.html

As you say, your build.gradle should be without Google Mobile Ads SDK library:

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v13:13.0.0'
    compile 'com.google.android.gms:play-services:4.0.30'
}

But Google Mobile Ads SDK doesn't support DoubleClick For Publishers, Ad Exchange or Search Ads for Mobile Apps yet. They say that soon will be supported. If this is your case, use the previous version of Play Services combined with Google Mobile Ads SDK:

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v13:13.0.0'
    compile 'com.google.android.gms:play-services:3.2.65'
    compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
}

Upvotes: 4

Related Questions