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.
It sounds like a duplication of classes between a library (or libraries) and the main project:
http://parceler.org/#avoiding_parcels_indexing
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.
Related
I'm trying to build a release app via Android Studio > Generate Signed Bundle or APK > Android App Bundle > Release
However gradle fails with
: > Task :core:transformClassesWithMergeClassesForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':core:transformClassesWithMergeClassesForRelease'.
> 1 exception was raised by workers:
java.util.zip.ZipException: duplicate entry: META-INF/app_release.kotlin_module
In my build.gradle I've tried adding:
packagingOptions {
exclude 'META-INF/app_release.kotlin_module'
}
But it isn't making any difference whatsoever.
How do I fix this?
For extra context, it's a multi module project.
I have a core module, and an installed module which is declared in the core build.gradle with dynamicFeatures = [":installed"]
Thanks
Please make sure all your dependencies are api or implementation,
I have the flowing dependency grap.
meemo_sdk:
api project(":gvoice")
app project:
implementation project(":gvoice")
implementation project("meemo_sdk")
It complains "META-INF/gvoice_debug.kotlin_module" collision.
After change api to implementation, it works!
So I figured it out.
I pressed shift twice in Android studio (to open up the search everywhere dialog) and searched for app_release.kotlin_module
I saw two files, that were under two of my dependencies (which funnily enough were libraries that I had created!)
I opened up these library projects, and in the build.gradle file I had to add:
ext {
PUBLISH_GROUP_ID = 'com.companyname'
PUBLISH_ARTIFACT_ID = 'packagename'
}
android {
...
compileOptions {
kotlinOptions.freeCompilerArgs += ['-module-name', "$PUBLISH_GROUP_ID.$PUBLISH_ARTIFACT_ID"]
}
}
Rebuilt the library projects with new versions, used these new versions in my other project, and it started compiling :)
Build -> Clean Project Worked for me
I found the same issue comes randomly by using Android Studio 4.2.1 and Java8, I sorted out successfully by deleting .gradle file in the project (not the main one) every time I get the error.
Java version: JDK8221
Kotlin: 1.5.0
AndroidStudio: 4.2.1
Not the best solution but is a good workaround for now.
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/v7/appcompat/R$anim.class
It appears you are including the appCompat v7 library more then once. You may need to do a replace in your manifest page to avoid this issue.
For example you can override the gms version like this
You may need to do the equivelent for appcompat or find out which libraries are including it. Consider setting their transitives = false to avoid pulling it in muliple times.
Also view your dependency tree to see where/what dependencies are being overwritten at compile time.
This could also be a propagated error because of duplicated JAR files in your libs directory that are also in your Gradle dependency section.
But basically you have a duplicated dependency.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzahl.class
In terminal execute in root project folder:
./gradlew clean
Try this!
The documentation says that.
Each version of FirebaseUI has dependency on a fixed version of these
libraries, defined as the variable firebase_version in
common/constants.gradle. If you are using any dependencies in your app
of the form compile 'com.google.firebase:firebase-:x.y.z' or compile
'com.google.android.gms:play-services-:x.y.z' you need to make sure
that you use the same version that your chosen version of FirebaseUI
requires.
When I try to build apk android studio gives me this error.
Can anyone has any idea about this error?
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: permissions/dispatcher/GrantableRequest.class
If you are using PermissionsDispatcher library thn its mentioned as issue for duplicate class entry.
How to Check attached libraries Dependency/hierarchy ? which causes duplicate entry for libraries.
In your case you need to make changes as per mentioned in libraries known issue.
compile 'com.github.hotchemi:permissionsdispatcher:2.0.3'
compile 'com.github.hotchemi:permissionsdispatcher-processor:2.0.3'
Make changes as per below
compile 'com.github.hotchemi:permissionsdispatcher:2.0.3'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.3'
For more details on duplicate entry issue please check this
UPDATE
Its required to define apt dependecies in root level build.gradle file also
check this for root level build.gradle file declaration.
Let me know if anything
Am using the following library Autobahn for web sockets usage in my Android project.
When am using the old gradle version 1.3.0, am not encountering any issues in building & running the app, whereas
when i update the gradle version to 1.5.0, am encountering the following issue.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: de/tavendo/autobahn/ByteBufferInputStream.class
I have tried the below options already
1. multiDexEnabled is set to true in gradle file.
2. gradlew clean is also done, along with clean build.
Any other suggestions to resolve this issue would be great.
Regards,
Dinesh Kumar G
Here is a interesting way to add Autoban build to gradle. Try to remove your jar and add this in your build file.