Search code examples
androidparcelableparceler

Parceler ZipException "duplicate entry"


I'm building a project which has two classes (A and B) that both inherit from BaseClass. Both classes, A and B, have the annotation @Parceler. When I build it for a phone with OS ver 4.1.2 (API 16), it gives me this error:

Execution failed for task ':app:transformClassesWithJarMergingForDebug'.  
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:  
com/example/BaseClass$$PackageHelper.class

If I build it for a phone with Nougat, there are no problems.

I had read about using parcelsIndex, but Parceler doesn't support with the version I'm using - 1.1.8.

Are there any fixes for this problem?


Solution

  • I was using the classes in different modules - this seemed to have caused it. While there are may be some solutions using @ParcelClass annotation (https://github.com/johncarl81/parceler/issues/225 ?), I simply moved them to the same module, and it's building fine now.