javaandroidmopub

Error while mopub integartion


I am integrating MOPUB ADs in application. I am following MOPUB SDK integration steps from https://www.mopub.com/resources/docs/android-sdk-integration/android-getting-started/

After adding mopub-volley-1.1.0.jar, I got following error.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/mopub/volley/AuthFailureError.class

My build.gradle code is

apply plugin: 'com.android.application'
android {
    compileSdkVersion 24
    buildToolsVersion '24.0.1'

    defaultConfig {
        multiDexEnabled true
        applicationId "com.mopubdemo.android"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 27
        versionName '2.05'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/plexus/components.xml'
   }
}

dependencies {
   compile files('libs/universal-image-loader-1.9.3.jar')
   compile files('libs/FlurryAnalytics-6.2.0.jar')
   compile files('libs/acra-4.6.1.jar')

   compile project(':mopub-sdk:mopub-sdk-native-video')
   compile project(':mopub-sdk:mopub-sdk-native-static')
   compile project(':mopub-sdk:mopub-sdk-banner')
   compile project(':mopub-sdk:mopub-sdk-rewardedvideo')
   compile project(':mopub-sdk')
   compile project(':mopub-sdk:mopub-sdk-interstitial')

   androidTestCompile 'junit:junit:4.12'
   compile 'com.android.support:multidex:1.0.1'
   compile 'com.github.johnkil.android-robototextview:robototextview:2.4.2'
   compile 'com.google.code.gson:gson:2.4'
   compile 'com.rengwuxian.materialedittext:library:2.1.4'
   compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
   compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
   compile 'com.nhaarman.listviewanimations:lib-core-slh:3.1.0@aar'
   compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
   compile 'com.koushikdutta.ion:ion:2.1.6'
   compile 'pub.devrel:easypermissions:0.1.5'
   compile 'com.android.support:appcompat-v7:24.2.1'
   compile 'com.android.support:cardview-v7:24.1.1'
   compile 'com.android.support:support-v4:24.1.1'
   compile 'com.android.support:recyclerview-v7:24.1.1'
   compile 'com.android.support:support-annotations:24.1.1'
   compile 'com.google.android.gms:play-services:10.2.1'

  compile files('libs/mopub-volley-1.1.0.jar')
}

Solution

  • Remove this line and then sync

    compile files('libs/mopub-volley-1.1.0.jar')