Android Build failed with duplicate class error - android

I'm getting duplicate class error when building my application.
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: javax.annotation.Nonnegative$Checker
I would like to track down javax.annotation.Nonnegative$Checker and which libraries are using it. Please guide me how to track duplicate classes in android.

I resolved this by upgrading dagger version from 2.10 to 2.15. Hope this helps someone.

Related

Why does it give Unable to merge dex for play-services-safetynet?

I added this in the build.gradle file: implementation 'com.google.android.gms:play-services-safetynet:12.0.1'
Then it shows this error: Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
I'm using f_grecaptcha and followed the documentation but still got this error.
Is there any way to fix this?

A library is internally compiling another version of a library that I need externally?

There's a library that I need to integrate in my project:
adobeMobileLibrary-4.14.0.jar
But when I try to run it gives me this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/adobe/mobile/AbstractDatabaseBacking$CorruptedDatabaseException.class
So I found that a compiled .aar library is internally compiling the same adobeMobileLibrary but in another version.
What would be the best way to solve this type of problem?

Dex merger issuse after upgrading library

after i upgrade library in the project
(realm from 4.2.0 to 4.3.1)
to the latest version i got this error
error:java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException:
Error while merging dex archives:
***build\transforms\dexBuilder\debug\1.jar, C:\android-
***build\intermediates\transforms\dexBuilder\debug\2.jar
.... 650 of build\transforms\dexBuilder\debug\....
allready tried to clean/build/reinstall/invalidate nothing work,
how to solve it?
You are probably running into this bug: https://github.com/realm/realm-java/issues/5640#issuecomment-355497076
There is a workaround in the link and a fixed release is incoming.

Error:Execution failed for task ':transformClassesWithJarMergingForRelease'

I am implementing facebook native ads in unity that needs gradle build from unity. After importing to Android Studio and gradle sync it runs well but during signed APK it produces the error which is.
Error:Execution failed for task ':transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/unity3d/ads/android/BuildConfig.class
This error means you have duplicate class definition for:
com.unity3d.ads.android.BuildConfig
Try look into your jar/aar to see if the class is present at multiple places.
I like to use grep (linux/osx) or 7-Zip to quickly explores my jar/aar files

Android duplicate webrtc class when I use 2 library dependencies on webrtc

I got error when I use twillio and sora library.
Error:Execution failed for task ':quickstart:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/webrtc/Camera1Session$2.class
I've researched and I know that 2 library extend from org.webrtc, so When android system build then I will duplicate org.web.
I spent 3 weeks for this issue, but i cannot resolve.
Any solution would be appreciate
Thank!

Categories

Resources