Error:Execution failed for task ':Application:transformClassesWithJarMergingForDebug' [duplicate] - android

This question already has answers here:
TransformException duplicate entry for common.annotations.Beta
(3 answers)
Closed 6 years ago.
While running my android application in android studio, I got the following error:
Error: Execution failed for task':App:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException:
duplicate entry: android/support/annotation/LayoutRes.class
Where does that error come from / how to resolve that issue?

You have added com.android.support:support-annotations: two times. Surely, not directly, but one of your dependencies depends on it. Run from console (inside project folder): gradlew app:dependencies and see what depends on support annotations library.
Then, exclude dependencies

Related

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!

Updating to Android Studio 3.0 Canary 2 give build errors [duplicate]

This question already has answers here:
AAPT2 compile failed: invalid dimen on Android 3.0 Canary 1
(7 answers)
Closed 5 years ago.
Today I updated my Studio to Canary 2 and a strange build error arises:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :multipicker:generateDebugSources, :multipicker:generateDebugAndroidTestSources, :multipicker:mockableAndroidJar]
Information:0 errors
Information:0 warnings
Information:See complete output in console
Error:/home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:795 invalid drawable
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
Error:Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed:
aapt2 compile -o /home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/res/merged/debug /home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Issues:
- ERROR: /home/master/AndroidStudioProjects/Reweyou/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:795 invalid drawable
Information:BUILD FAILED in 11s
I managed to run Android Studio 3 Canary 2 with Gradle 3.0.0-alpha2 based on this answer: https://stackoverflow.com/a/44202755/3936723
I use Linux, and for me this solved the problem:
Open terminal
Type:
export LC_NUMERIC="en_US.UTF-8"
sh ./android-studio/bin/studio.sh
--OLD ANSWER--
It will work in Android Studio 3.0 Canary, if you change Gradle to
classpath 'com.android.tools.build:gradle:2.3.2'
I have the same error with com.android.tools.build:gradle:3.0.0-alpha2 version, rolling back to previous version of Gradle fix a problem for me.
Unfortunately, with older gradle plugin, I can't use advanced options in Android profiler :(
The solution has been provided here.
You need to change your PC regional format for numbers to one that use the dot as decimal mark, like English US / UK.
Android Studio Canary 2 changes Gradle to com.android.tools.build:gradle:3.0.0-alpha2
A workaround is set back to com.android.tools.build:gradle:3.0.0-alpha1

Error on adding googlemaps to my android app after updating Android Studio [duplicate]

This question already has answers here:
DexIndexOverflowException issue after updating to latest appcompat and support library
(7 answers)
Closed 6 years ago.
How to solve this?
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
You have reached to 65k method limit.You either remove some dependencies which are not being used or use multidex.
https://developer.android.com/studio/build/multidex.html

TransformException after updating gradle version

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.

Categories

Resources