Ritt
Ritt

Reputation: 3349

Duplicate Dependency Error At Run Time

I added Parceler Dependency, in build.gradle.

dependencies {
    // Parceler
    compile 'org.parceler:parceler-api:1.0.4'
    apt 'org.parceler:parceler:1.0.4'
}

When i build the project, the project builds successfully but at run time it's throwing the below error.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/parceler/Parceler$$Parcels$1.class

I tried ./gradlew clean command, i did invalidate and restart cache. I also update my android studio to 12.1 preview and gradle to 2.10, but still the same issue.

Any kind of help or suggestions would be appreciated.

Upvotes: 1

Views: 519

Answers (2)

Ritt
Ritt

Reputation: 3349

After going through the parceler.org doc, i solved this issue by setting parcelsIndex = false to each of the model classes.

Parceler will not write a Parceler$$Parcels mapping class if no indexable classes exist and the Parcels utiltiy class will fallback to looking up the generated class by name.

Upvotes: 1

John Ericksen
John Ericksen

Reputation: 11113

It sounds like a duplication of classes between a library (or libraries) and the main project: http://parceler.org/#avoiding_parcels_indexing

Upvotes: 1

Related Questions