我使用gdx-setup來創建project.my ide是Android Studio for mac。 我沒有使用gdx.jar。我將gdx源代碼添加到核心模塊,並將一些自定義方法添加到SpriteBatch。使用libgdx源代碼,Android模塊構建錯誤
我解決的build.gradle這樣的:
project(":core") {
apply plugin: "java"
dependencies {
//compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-jnigen:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
}
}
桌面和iOS是好的,但有一個機器人生成錯誤。
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/badlogic/gdx/Application$ApplicationType;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
:android:transformClassesWithDexForDebug FAILED
我只將gdx java源代碼添加到我的項目中。 – AC123