I'm programming an application on Eclipse which use the lib JIBX. I strater to follow this tutorial : "http://www.ibm.com/developerworks/java/tutorials/j-jibx2/". It works perfectly on a classic JAVA project. I can generate a xsd from a classe, generate classes from a xsd and execute the program which return the corrects results.

I wanted to do this tuto on android. I imported the same libs as in the classic projet (JIBX should work on android). I can generate classes and objects, but when I try to compile this project, an error appear on the virtual phone and the LogCat show this message :

09-10 12:33:54.957: I/Process(1905): Sending signal. PID: 1905 SIG: 9
09-10 12:34:05.047: I/dalvikvm(1944): Could not find method org.jibx.runtime.BindingDirectory.getFactory, referenced from method com.example.jibxtestandroid.MainActivity.calcul
09-10 12:34:05.079: W/dalvikvm(1944): VFY: unable to resolve static method 25: Lorg/jibx/runtime/BindingDirectory;.getFactory (Ljava/lang/Class;)Lorg/jibx/runtime/IBindingFactory;
09-10 12:34:05.079: D/dalvikvm(1944): VFY: replacing opcode 0x71 at 0x0004
09-10 12:34:05.079: W/dalvikvm(1944): VFY: unable to resolve exception class 34 (Lorg/jibx/runtime/JiBXException;)
09-10 12:34:05.079: W/dalvikvm(1944): VFY: unable to find exception handler at addr 0x8
09-10 12:34:05.087: W/dalvikvm(1944): VFY:  rejected Lcom/example/jibxtestandroid/MainActivity;.calcul ()Ljava/lang/String;
09-10 12:34:05.087: W/dalvikvm(1944): VFY:  rejecting opcode 0x0d at 0x0008
09-10 12:34:05.087: W/dalvikvm(1944): VFY:  rejected Lcom/example/jibxtestandroid/MainActivity;.calcul ()Ljava/lang/String;
09-10 12:34:05.087: W/dalvikvm(1944): Verifier rejected class Lcom/example/jibxtestandroid/MainActivity;
09-10 12:34:05.087: W/dalvikvm(1944): Class init failed in newInstance call (Lcom/example/jibxtestandroid/MainActivity;)
09-10 12:34:05.087: D/AndroidRuntime(1944): Shutting down VM
09-10 12:34:05.087: W/dalvikvm(1944): threadid=1: thread exiting with uncaught exception (group=0x414c4700)
09-10 12:34:05.147: E/AndroidRuntime(1944): FATAL EXCEPTION: main
09-10 12:34:05.147: E/AndroidRuntime(1944): java.lang.VerifyError: com/example/jibxtestandroid/MainActivity
09-10 12:34:05.147: E/AndroidRuntime(1944):     at java.lang.Class.newInstanceImpl(Native Method)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at java.lang.Class.newInstance(Class.java:1130)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.os.Looper.loop(Looper.java:137)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at android.app.ActivityThread.main(ActivityThread.java:5103)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at java.lang.reflect.Method.invokeNative(Native Method)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at java.lang.reflect.Method.invoke(Method.java:525)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-10 12:34:05.147: E/AndroidRuntime(1944):     at dalvik.system.NativeStart.main(Native Method)
09-10 12:39:05.443: I/Process(1944): Sending signal. PID: 1944 SIG: 9

I begun to add to build-path jibx-run.jar and to cross it, in order and export. I even put it on the top. Nothing changed, the message error was still the same. So I did the same thing but with all the libs imported from JIBX in my project. Then, eclipse crash and show this in a box : "Unable to execute dex: Java heap space ", which significate that the lib are too big (7 Mo) Have you an idea ? Libs are correctly included and there is no error on Eclipse. Thanks

1

There are 1 answers

0
Don Corley On BEST ANSWER

Take a look at my blog at Android programming with JiBX for a nice description of how to use JiBX with Android.

Good Luck!

Don Corley

JiBX contributor