rekoDolph
rekoDolph

Reputation: 823

multiple dex files - conversion to dalvik format failed

I'm making a game on libgdx and it all worked fine yesterday, but now it's messed up.

[2014-09-18 00:38:39 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/badlogic/gdx/Application$ApplicationType;
[2014-09-18 00:38:39 - birdy-android] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/badlogic/gdx/Application$ApplicationType;

That is the error I got. I've been trying to find an answer and I can't find one that works anywhere.

Upvotes: 0

Views: 603

Answers (2)

Olivier Panczuk
Olivier Panczuk

Reputation: 41

In addition to Lestat answer, it might also happen when you are adding a jar to the build path of your android project and in the same time in the 'libs' folder of this project.

To avoid this, you will have to remove the jar from the build path, and put it in the libs folder only.

Upvotes: 1

Daahrien
Daahrien

Reputation: 10320

That happens when you define the same class (with same path) twice. In this case the class is:

Multiple dex files define Lcom/badlogic/gdx/Application$ApplicationType;

Which is in the Libgdx core jar.

So 2 possible escenarios:

  • You created your project manually and added the jar in your build path twice.

  • You created your project using Gradle and you mistakenly added the jar as a dependency twice:

    project(":core") {
        apply plugin: "java"
    
        dependencies {
            compile "com.badlogicgames.gdx:gdx:$gdxVersion"
            compile "com.badlogicgames.gdx:gdx:$gdxVersion" <--
            compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        }
    }
    

So, just delete the cloned dependency, or fix your build path to not add the jar twice. (You can always remake the project and copy your old code though).

Upvotes: 3

Related Questions