MoPub: TransformException - ZipException: duplicat

2019-09-10 03:48发布

问题:

I'm trying to integrate MoPub into my app.

I imported the sdk into my app:

compile('com.mopub.sdk.android:mopub:4.4.1@aar') {
    transitive = true;
}

But an error is returned when I tried to build it.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqq$zza.class

I have imported the com.google.android.gms llibrary into my app:

compile('com.google.android.gms:play-services-base:8.3.0') {
    exclude module: 'support-v4'
}
compile('com.google.android.gms:play-services-location:8.3.0') {
    exclude module: 'support-v4'
}
compile('com.google.android.gms:play-services-gcm:8.3.0') {
    exclude module: 'support-v4'
}
compile('com.google.android.gms:play-services-maps:8.3.0') {
    exclude module: 'support-v4'
}
compile('com.google.android.gms:play-services-appinvite:8.3.0') {
    exclude module: 'support-v4'
}
compile('com.google.android.gms:play-services-analytics:8.3.0') {
    exclude module: 'support-v4'
}

So I thought I would exclude them from the sdk:

compile('com.mopub.sdk.android:mopub:4.4.1@aar') {
    exclude group: 'com.google.android.gms'
}

Still doesn't work.

Then I tried to remove transitive:

compile('com.mopub.sdk.android:mopub:4.4.1@aar')

Still doesn't work.

How do I get this MoPub sdk to integrate successfully into my android app?

回答1:

Actually I found the answer.

I'm trying to use the facebook audience network sdk and that sdk was the one that caused the conflict - doing this in the facebook audience network sdk caused the app to compile again.

compile ('com.facebook.android:audience-network-sdk:4.+') {
    exclude group: 'com.google.android.gms'
}