Question

I want to use SOAP in jMonkey3 Engine to transfer files to server. ksoap-android-assembly-3.3 is a free library for using SOAP on android without any hassles. However when I added a ksoap jar file in my jMonkey project, the android build failed in a DexException. I have tried everything including creating a fresh project but the error persists. The project builds without any error as soon as I remove the jar file. I have added the build output below. The build process for desktop jar application works fine and ksoap library also works flawlessly. Kindly help.

ant -f C:\\Users\\Gursimar\\Documents\\JMonkey\\SBA_drag_drop_git run-android
init:
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\build\built-jar.properties
compile:
Copying 1 file to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\build
Copy libraries to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\dist\lib.
Building jar: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\dist\sba.jar
To run this application from the command line without Ant, try:
java -jar “C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\dist\sba.jar”
jnlp:
Copying application libraries to android project.
Deleting directory C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs
Created dir: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs
Copying 29 files to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\assets.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-desktop.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-lwjgl.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-lwjgl-natives.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-jbullet.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jbullet.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\stack-alloc.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\vecmath.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\lwjgl.jar
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jinput.jar
Adding libraries for android.
Copying 3 files to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs
Replacing bullet library with android native version.
Copying 3 resources to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs
Deleting: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-bullet-natives-android.jar
Deleting directory C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\x86
Unzipping Assets to Android Directories
Deleting directory C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\assets
Created dir: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\assets
Expanding: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\dist\lib\assets.jar into C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\assets
Copying 1 file to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs
jar:
run-android:
Building debug android application version.
Android SDK Tools Revision 22.3.0
Installed at C:\Users\Gursimar\adt-bundle-windows-x86_64-20130729\sdk
Project Name: sba
Project Type: Application
Using latest Build Tools: 18.0.1
Resolving Build Target for sba…
Project Target:   Android 4.3
API level:        18
———-
Creating output directories if needed…
———-
Resolving Dependencies for sba…
Library dependencies:
No Libraries
——————
———-
Building Libraries with ‘debug’…
No sub-builds to iterate on
Found Deleted Target File
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
Handling aidl files…
No AIDL files to compile.
———-
Handling RenderScript files…
———-
Handling Resources…
Found Deleted Target File
Generating resource IDs…
———-
Handling BuildConfig class…
No need to generate new BuildConfig.
Compiling 1 source file to C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\bin\classes
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\bin\classes
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\log4j-1.2.12.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-jogg.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-android.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\slf4j-api-1.7.5.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-plugins.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\nifty-default-controls.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-niftygui.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-core.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\guava-12.0.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\j-ogg-vorbisd.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\nifty-style-black.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\j-ogg-oggd.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\sba.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\eventbus.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-bullet.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-terrain.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-effects.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\xmlpull-xpp3.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\slf4j-log4j12-1.7.5.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-networking.jar
input: C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\nifty.jar
Using Pre-Dexed log4j-1.2.12-12872684bd52640e2f51036e785b422a.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\log4j-1.2.12.jar
Using Pre-Dexed jME3-jogg-617e4d70170a5be284d07c96f03e2c38.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-jogg.jar
Using Pre-Dexed jME3-android-7e6dd940f3d67c7a89958b1e0a1f0d01.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-android.jar
Pre-Dexing C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar -> ksoap2-android-assembly-2.6.0-jar-with-dependencies-efeee7931794e5a6989df6432ca26fcb.jar
warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.ksoap2.transport.KeepAliveHttpsTransportSE$1) that doesn’t come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any “-target” type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
Using Pre-Dexed slf4j-api-1.7.5-7630fdf30323e4b726082fc97c248894.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\slf4j-api-1.7.5.jar
Using Pre-Dexed jME3-plugins-857ed28ae4fb576f11d8a47dac535713.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-plugins.jar
Using Pre-Dexed nifty-default-controls-8f2d449e5a016813c2755fc5016e7aae.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\nifty-default-controls.jar
Using Pre-Dexed jME3-niftygui-1bcb17e0e6ef39b7de20ffd4a6805d8c.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-niftygui.jar
Using Pre-Dexed jME3-core-eac6523cafcb14386af4d63c0a55a17f.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-core.jar
Using Pre-Dexed guava-12.0-7b7827cec811c109748e2b5bcd4ffec5.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\guava-12.0.jar
Using Pre-Dexed j-ogg-vorbisd-1ded175cfa4814cad526a19ca85d19bd.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\j-ogg-vorbisd.jar
Using Pre-Dexed nifty-style-black-b4d3d7bff7152cde518c90bc7549810f.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\nifty-style-black.jar
Using Pre-Dexed j-ogg-oggd-299a0debfd8e71ee78450e7c33fd95c8.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\j-ogg-oggd.jar
Pre-Dexing C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\sba.jar -> sba-88ee1eef99c0f96ea202d4190ab6cf49.jar
Using Pre-Dexed eventbus-25f6858cca49b36b4b58635c37918d31.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\eventbus.jar
Using Pre-Dexed jME3-bullet-25f4cf347cd8b4a410bc65fa0c1396ee.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-bullet.jar
Using Pre-Dexed jME3-terrain-2e7e1be7c0c70afa27d40facbe10885a.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-terrain.jar
Using Pre-Dexed jME3-effects-5154e6197bf4408c6752d8ceb3b78d47.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-effects.jar
Using Pre-Dexed xmlpull-xpp3-6f61bc8d886edebb7af257c7f84f5bc2.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\xmlpull-xpp3.jar
Using Pre-Dexed slf4j-log4j12-1.7.5-05b432b95dbb7d6738b043baf0d1e7e3.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\slf4j-log4j12-1.7.5.jar
Using Pre-Dexed jME3-networking-35fccaab330c88d1b77add3e4b078e69.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\jME3-networking.jar
Using Pre-Dexed nifty-3101f3c9091ff6aa9ad07bc874dc1eb3.jar <- C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\libs\nifty.jar
Found Deleted Target File
Converting compiled files and external libraries into C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\mobile\bin\classes.dex…
Merged dex A (7 defs/2.2KiB) with dex B (253 defs/307.9KiB). Result is 260 defs/373.5KiB. Took 0.3s
Merged dex A (260 defs/373.5KiB) with dex B (5 defs/11.4KiB). Result is 265 defs/487.4KiB. Took 0.1s
Merged dex A (265 defs/487.4KiB) with dex B (58 defs/161.5KiB). Result is 323 defs/849.9KiB. Took 0.1s
Merged dex A (323 defs/849.9KiB) with dex B (63 defs/152.0KiB). Result is 386 defs/1383.9KiB. Took 0.1s
Result compacted from 2098.7KiB to 641.4KiB to save 1457.3KiB
Merged dex A (386 defs/1383.9KiB) with dex B (23 defs/27.1KiB). Result is 409 defs/641.4KiB. Took 0.2s
Merged dex A (409 defs/641.4KiB) with dex B (18 defs/97.9KiB). Result is 427 defs/900.2KiB. Took 0.1s
Merged dex A (427 defs/900.2KiB) with dex B (216 defs/203.1KiB). Result is 643 defs/1400.6KiB. Took 0.2s
Merged dex A (643 defs/1400.6KiB) with dex B (20 defs/37.5KiB). Result is 663 defs/1947.0KiB. Took 0.1s
Result compacted from 4299.3KiB to 2051.1KiB to save 2248.2KiB
Merged dex A (663 defs/1947.0KiB) with dex B (596 defs/1148.5KiB). Result is 1259 defs/2051.1KiB. Took 0.3s
Merged dex A (1259 defs/2051.1KiB) with dex B (1342 defs/1560.4KiB). Result is 2601 defs/4575.4KiB. Took 0.3s
Result compacted from 6232.7KiB to 3666.2KiB to save 2566.6KiB
Merged dex A (2601 defs/4575.4KiB) with dex B (23 defs/46.1KiB). Result is 2624 defs/3666.2KiB. Took 0.4s
Merged dex A (2624 defs/3666.2KiB) with dex B (16 defs/25.6KiB). Result is 2640 defs/4708.6KiB. Took 0.1s
Result compacted from 6579.2KiB to 3802.2KiB to save 2777.0KiB
Merged dex A (2640 defs/4708.6KiB) with dex B (89 defs/132.7KiB). Result is 2729 defs/3802.2KiB. Took 0.3s
Result compacted from 4957.7KiB to 3883.2KiB to save 1074.5KiB
Merged dex A (2729 defs/3802.2KiB) with dex B (63 defs/87.8KiB). Result is 2792 defs/3883.2KiB. Took 0.3s
Result compacted from 5152.3KiB to 4033.2KiB to save 1119.1KiB
Merged dex A (2792 defs/3883.2KiB) with dex B (75 defs/163.1KiB). Result is 2867 defs/4033.2KiB. Took 0.3s
Result compacted from 5342.4KiB to 4178.1KiB to save 1164.4KiB
Merged dex A (2867 defs/4033.2KiB) with dex B (84 defs/160.6KiB). Result is 2951 defs/4178.1KiB. Took 0.3s
Result compacted from 5402.6KiB to 4228.0KiB to save 1174.5KiB
Merged dex A (2951 defs/4178.1KiB) with dex B (25 defs/60.9KiB). Result is 2976 defs/4228.0KiB. Took 0.3s

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexException: Multiple dex files define Lorg/xmlpull/v1/XmlPullParser;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531)
    at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
    at com.android.dx.command.dexer.Main.run(Main.java:232)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)

C:\Users\Gursimar\Documents\JMonkey\SBA_drag_drop_git\nbproject\mobile-impl.xml:10: The following error occurred while executing this line:
C:\Users\Gursimar\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml:892: The following error occurred while executing this line:
C:\Users\Gursimar\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml:894: The following error occurred while executing this line:
C:\Users\Gursimar\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml:906: The following error occurred while executing this line:
C:\Users\Gursimar\adt-bundle-windows-x86_64-20130729\sdk\tools\ant\build.xml:284: null returned: 2
BUILD FAILED (total time: 19 seconds)
Was it helpful?

Solution

One reason for a DexException is adding a jar library more than once in the build process. Your jMonkey project possibly includes nifty libraries which already has xmlpull library included. You must remove the library from either of the two jars. You can use winrar to edit a jar and manually delete the libraries compiled byte code files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top