Exception while using ksoap2-android

和自甴很熟 提交于 2019-12-10 10:24:00

问题


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

Am I missing someging?


回答1:


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.




回答2:


You can try to add the KSOAP2 to your "Order and Export" tab. To do that:
01- Right click on the name of your project
02- Click on Properties
03- Select Java Build Path 04- Check if the KSOAP Library is already on the Libraries Tab
05- Click on the Order and Export tab and check the checkbox next to ksoap2-android-assembly.

Export your project again and try it. It should work now.



来源:https://stackoverflow.com/questions/10030233/exception-while-using-ksoap2-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!