Question

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.

Was it helpful?

Solution 2

Solved,

I removed libraries, reload project, add libraries, removed my references to support-v4, removed libraries again, build, add libraries, build, added back references and build.

OTHER TIPS

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.

I removed from /libs folder and cleaned and rebuild it again.problem fixed

GoogleAdMobAdsSdk-6.4.1
android-support-v4
  1. Clean Project
  2. Rebuild Project
  3. Run
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top