-1

I am getting error while building react-native app using command react-native run-android

Error

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzav;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzav;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)

:app:transformClassesWithDexForDebug FAILED

Failure

Build failed with an exception.

What went wrong

Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: 
com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

Dependencies in android/app/build.gradle

Saveendra Ekanayake
  • 3,153
  • 6
  • 34
  • 44
Anant kamat
  • 373
  • 3
  • 13

2 Answers2

1

delete android/app/build dir This work for me.

孙欣乐
  • 417
  • 3
  • 8
  • can you check this Q https://stackoverflow.com/questions/59096566/execution-failed-for-task-apptransformdexarchivewithdexmergerfordebug-rea – Oliver D Nov 29 '19 at 00:48
0

As mentionned on this comment, you have to compile everything yourself. Add this in your android/app/build.gradle.

I don't know if you have the exact same problem, but everytime I ran in dex problems, this was the solution.

  compile "com.google.android.gms:play-services-base:11.4.2"
  compile "com.google.android.gms:play-services-base-license:11.4.2"
  compile "com.google.android.gms:play-services-ads:11.4.2"
  compile "com.google.android.gms:play-services-ads-lite:11.4.2"
  compile "com.google.android.gms:play-services-ads-license:11.4.2"
  compile "com.google.android.gms:play-services-analytics:11.4.2"
  compile "com.google.android.gms:play-services-analytics-impl:11.4.2"
  compile "com.google.android.gms:play-services-auth:11.4.2"
  compile "com.google.android.gms:play-services-auth-base:11.4.2"
  compile "com.google.android.gms:play-services-fitness:11.4.2"
  compile "com.google.android.gms:play-services-gcm:11.4.2"
  compile "com.google.android.gms:play-services-identity:11.4.2"
  compile "com.google.android.gms:play-services-maps:11.4.2"
  compile "com.google.android.gms:play-services-wallet:11.4.2"
Poptocrack
  • 2,879
  • 1
  • 12
  • 28
  • can you check this Q https://stackoverflow.com/questions/59096566/execution-failed-for-task-apptransformdexarchivewithdexmergerfordebug-rea – Oliver D Nov 29 '19 at 00:47