I am trying to integrate barcodefraglibv2 into my android app in AndroidStudio. I tried to copy libs core.jar and barcodelib.jar into libs directory. However when I try to run application, I get following error
Error:Execution failed for task ':Blok:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/backman/android/sdk/build-tools/android-4.4.2/dx --dex --output /home/backman/AndroidStudioProjects/Blok/Blok/build/dex/debug /home/backman/AndroidStudioProjects/Blok/Blok/build/classes/debug /home/backman/AndroidStudioProjects/Blok/Blok/build/dependency-cache/debug /home/backman/AndroidStudioProjects/Blok/Blok/build/pre-dexed/debug/core-bcdbe5f84dd399255abb34d14ce9def109db2534.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/BarcodeFormat;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
I have no luck trying to solve it.
You have multiple copies of the classes in zxing
in your app. You should likely have exactly one copy: the core
.jar in libs/
and nothing else.