Android Studio: Error converting bytecode to dex
kirby510 opened this issue · 4 comments
Hi,
When I set the dependencies as below:
compile 'com.cloudinary:cloudinary-android:1.14.0'
compile 'org.apache.commons:commons-io:1.3.2'
Android Studio give me this error when build and run the application:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/io/filefilter/NotFileFilter;
Error:com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/io/filefilter/NotFileFilter;
Error: at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Error: at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:60)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
Error: at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Error: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForMinApi14Debug'.
com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lorg/apache/commons/io/filefilter/NotFileFilter;
How can I fix for the issue above?
Hi @kirby510,
Thanks for reaching out.
I've tried to add the apache dependency to replicate the issue but it worked for me.
What version of gradle are you using (gradle and Android plugin)?
I have the following configured -
Project gradle (Android gradle plugin)-
classpath 'com.android.tools.build:gradle:2.3.3'
and gradle 4.0.1
Try to update your gradle. If it still doesn't work, please share all your gradle files for us to further investigate.
Let me know of any updates.
Actually I just found out one of gradle library caused me the issue. After I change to the correct library then it's solved... Thanks for reply and sorry for the trouble.
Thanks for the update, glad to hear it's working for you now:)
Feel free to reach out again with further questions.