Home » Android » compiler errors – Android Dex: [ActivityName] Unable to execute DX

compiler errors – Android Dex: [ActivityName] Unable to execute DX

Posted by: admin June 15, 2020 Leave a comment

Questions:

When i compile my project i’m given this kind of errors ;

Error:Android Dex: [OdeAl] Unable to execute DX
Error:Android Dex: [OdeAl] com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Error:Android Dex: [OdeAl] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
Error:Android Dex: [OdeAl] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
Error:Android Dex: [OdeAl] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
Error:Android Dex: [OdeAl] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
Error:Android Dex: [OdeAl] at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
Error:Android Dex: [OdeAl] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
Error:Android Dex: [OdeAl] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
Error:Android Dex: [OdeAl] at com.android.dx.command.dexer.Main.run(Main.java:230)
Error:Android Dex: [OdeAl] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:Android Dex: [OdeAl] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Error:Android Dex: [OdeAl] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Error:Android Dex: [OdeAl] at java.lang.reflect.Method.invoke(Method.java:597)
Error:Android Dex: [OdeAl] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161)
Error:Android Dex: [OdeAl] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294)
Error:Android Dex: [OdeAl] at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)

How can i fix this errors?

How to&Answers:

The problem is you have multiple imports of the same Library OR Class .

Actually, the error is saying that you have :

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImp

So, you should check whether you added same jar files more than once.
If yes,Remove any one of them from libs folder and clean your project.

Answer:

like @Josef answer , you can known what is jar file which had imported two time or more into android project From The error

Next Line into your Error:

com.android.dex.DexException: Multiple dex files define 

Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionI

That mean android-support-v4.jar file which had been imported twice or more into android project