1

I’ve been struggling to resolve a issue, tried several options, but couldn’t solve it.

Getting issue, only when creating signed apk :

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

Libs structure : http://prntscr.com/ay9uam

Dependency structure :

dependencies {
    compile 'com.android.support:multidex:1.0.1'

    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile project(':library')
    compile 'com.google.android.gms:play-services:8.4.0'
    //compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.pollfish:pollfish:+:googleplayRelease@aar'

}

Note : multiDexEnabled true and compile 'com.android.support:multidex:1.0.1' is what I need to add resolve one issue, so I've added it. 
 When I do, CMD+O(Mac) to search for AdViewController.class, I get : http://prntscr.com/ay9uoy

What should be my next step to resolve the issue, app runs fine for all cases (running in emulator, device..) and only at time of generating signed apk, I get above issue, which is last step of my task, I’m stuck at.

Any replies will be boon for me.

edovino
  • 3,315
  • 2
  • 22
  • 22
Hooda
  • 1,157
  • 1
  • 9
  • 16

2 Answers2

0

Looks like play-services already contains support-v4. Try excluding it from the classpath

compile('com.google.android.gms:play-services:8.1.0') {
exclude group: 'com.android.support', module: 'support-v4'
}

otherwise you use this ref: TransformException duplicate entry for common.annotations.Beta

Community
  • 1
  • 1
Damini Mehra
  • 3,257
  • 3
  • 13
  • 24
  • Do you know, what and how to exclude files when added as library in /libs folder. I need to exclude something as error points : duplicate entry: com/applovin/adview/AdViewController.class – Hooda Apr 29 '16 at 12:31
0

Finally I could solve the issue. As it was applovin class duplication, it needs to be excluded and trick was to do the following :

compile fileTree(include: ['*.jar'],excludes: ['applovin-sdk-6.1.5.jar'], dir: 'libs')

Hope it helps someone.

Hooda
  • 1,157
  • 1
  • 9
  • 16