I am building a view that has a vertical trail on git hub and added it on jitpack, but every time i do a release an download the package using gradle I have to do a clean Re-build().
Error:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Is it related to gitignore?
Repo: https://github.com/Mohammad-Tabbara/TrailedSheet
Note: i just changed .gitignore.
My problem has been solved it was related to .gitignore used:
https://github.com/github/gitignore/blob/master/Android.gitignore
And everything now is fine.
Would love to know the cause if any body would like to share.
Seams working so far.
Related
I ran my Android RN project today and was presented with the following error
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel$Stub
I believe that in order to resolve this, it is required to migrate to AndroidX.
I backed up my project and attempted to do it with Android Studio to no avail. I also tried setting it manually in my gradle.properties file
android.enableJetifier=true
android.useAndroidX=true
After this I tried removing supported libraries from my app/build.gradle, as well as setting targeted targetSdkVersion to 28.
These attempts resulted in more errors for me, specifically this one
Execution failed for task ':react-native-navigation:compileReactNative57_5DebugJavaWithJavac'.
I am using React Native 0.58.6 with Wix Navigation V2.
Help would be much appreciated
I ran into the same problem yesterday and finally figured it out, the reason of the above error is after migrating your android project to androidx, many of your react-native libraries ship native Java code and have not updated, I was able to solve it by using this library jetifier simply by running
npm i --save-dev jetifier
npx jetify
but in my case there were still some libraries causing some issues such us react-native-fast-image as a workaround, I created a gradle.properties inside /node_modules/react-native-fast-image/android and deactivated AndroidX and Jetifier for this module:
android.useAndroidX=false
android.enableJetifier=false
The answer that Ahmed posted is a great solution once you've migrated to AndroidX. In my case I didn't want to quite yet and found out that only one library in my application was using AndroidX from this thread
In short my solution was to simply yarn upgrade react-native-device-info#latest
The app build as expected after rebuilding it
Task :react-native-device-info:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-device-info:compileReleaseJavaWithJavac'.
java.io.FileNotFoundException: /workspace/eos-native/node_modules/react-native-device-info/android/build/intermediates/annotation_processor_list/release/annotationProcessors.json (No such file or directory)
The error makes sense , and the file is not there, but I have no idea why its not there? It is created when I run a debug version of the app and debug versions of my libraries, react-native-device-info, react-orientation-locker etc.. I've cleaned, gradle synched, rebuilt etc. but when trying to assemble or install a release build I get this error within seconds. What is causing the Java
I had the same problem in an android project (without react) when I added a library module.
After searching for a solution for quite some time, I finally deleted the .gradle directory in the project root folder.
This solved the problem for me.
update android gradle plugin to 3.3
update gradle to 4.10.3
fixed the issue for me.
The error :
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
You are implementing the whole play-services package. Try to filter out the dependencies you want to use. For example if you need location api then only compile 'com.google.android.gms:play-services-location:11.8.0'. Try commenting out this line 'com.google.android.gms:play-services:11.6.2'.
As your .gradle file suggests, you are explicitly adding the play services in your project and you are also adding firebase DB and appcompat library which is using a different version of the play services. Try to get the version which uses the same play services version.
If you do not know how to do it you can refer to the following command
./gradlew app:dependencies
If you want an in-depth answer please refer to this awesome thread full of the information.
Following is the good article on the conflict of Gradle dependencies.
After a rebuild I get :
Error:Execution failed for task ':demo:transformDexArchiveWithExternalLibsDexMergerForMockDebug'.
> com.android.builder.dexing.DexArchiveMergerException: com.android.tools.r8.errors.CompilationError: Program type already present: com.google.android.gms.common.internal.zzag
What does that error message mean? What is wrong?
when I replaces gradle implementation instruction by (the older) compile , it works.
The suggested workaround for this error is to delete the ./gradle folder inside your project or delete all the build folders and the gradle cache.
Additional references:
Dex error On Android Studio 3.0 Beta4
Unable to merge dex
Delete the .gradle directory.
Run your app again.
Notes
The .gradle directory is in your project's root folder. (You may have to show hidden files first.)
I have to do this every time I update a dependency module using Android 3.0.
Hope this helps!
This error (and any other Program type already present: com.google.android.gms.common.internal.xxxxxx error) can be caused by different Play Services and Firebase versions. Make sure all implementation 'com.google.android.gms:xxxx:12.0.0 and all implementation 'com.google.firebase:xxxxxx:12.0.0' have the same version (12.0.0) in this example.
Following the upgrade to Nativescript 2.5 I'm receiving a build error that I'm not quite sure how to fix. The error is:
Execution failed for task ':transformClassesWithDexForF0F1F2F3F4F5F6Debug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files
define Lcom/google/android/gms/iid/MessengerCompat$1;
I've spent some time looking into the issue and a Multiple Dex file exception seems to normally mean that two different versions of a dependency are being referenced. Yet I can't seem to find anything which relates to > MessengerCompat in the gradle files of any of my dependencies.
Thanks for any help!
For your case you could try to remove node_modules, platforms and hooks folders from your project and to clear npm cache with npm cache clear.
Then try to rebuild the app with tns run android.
It would also help if you could share the package.json file of the project.