Search code examples
javaandroidksoap2

Exception while using ksoap2-android


I have a problem regarding the ksoap2. My problem is that the project used to work well up to the time that I had to format my pc and set it up again.

I don't remember what version I had referenced in my application but I tried many of them and the problem still occurs.

04-05 13:56:18.289: E/dalvikvm(495): Could not find class  'org.ksoap2.serialization.SoapObject', referenced from method   com.giatrosofia.Activity_Votana$ConnectAndGetLst.doInBackground
04-05 13:56:18.289: W/dalvikvm(495): VFY: unable to resolve new-instance 223 (Lorg/ksoap2/serialization/SoapObject;) in Lcom/giatrosofia/Activity_Votana$ConnectAndGetLst;
04-05 13:56:18.289: D/dalvikvm(495): VFY: replacing opcode 0x22 at 0x0000
04-05 13:56:29.627: W/dalvikvm(495): threadid=9: thread exiting with uncaught exception (group=0x40014760)
04-05 13:56:29.809: E/AndroidRuntime(495): FATAL EXCEPTION: AsyncTask #1
04-05 13:56:29.809: E/AndroidRuntime(495): java.lang.RuntimeException: An error occured while executing doInBackground()
04-05 13:56:29.809: E/AndroidRuntime(495):  at android.os.AsyncTask$3.done(AsyncTask.java:266)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
04-05 13:56:29.809: E/AndroidRuntime(495):  at java.lang.Thread.run(Thread.java:1020)
04-05 13:56:29.809: E/AndroidRuntime(495): Caused by: java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject

The referenced file is ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar and the excpetion occured in

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

Here are the referenced jar files

Java Build Path

Am I missing someging?


Solution

  • if you are using new ADT 17

    then create one directory on root of your project named libs

    and just copy and paste ksop jar into libs dir.

    res

    bin

    libs --> your.jar file here

    as new updated it will work well.