Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android gradle packagingOptions pickFirst and exclude not working

EclipseLink jar contains some JPA classes. Android build APK fails:

Error:Execution failed for  
task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: 
java.util.zip.ZipException: duplicate entry: javax/persistence/Access.class

Tried both exclude and pickFirst as following

packagingOptions {

    exclude 'javax/persistence/**'
}


packagingOptions {

     pickFirst 'javax/persistence/**'
}

packagingOptions {

     pickFirst 'javax/persistence/Access.class'
}

None of them working.

like image 264
eastwater Avatar asked Oct 29 '22 06:10

eastwater


1 Answers

Having the same requirement I searched for quite some time for a solution.

Unfortunately, at the time of writing, those options only work in app modules! They have no effect whatsoever in library modules.

You have to copy those options to all your final app modules.

like image 141
3c71 Avatar answered Nov 09 '22 03:11

3c71