当我尝试使用kSoap2时,Android应用程序崩溃了

时间:2012-12-05 07:33:29

标签: android web-services ksoap2

嗨,我刚接触Android开发..抱歉。

当我尝试使用kSoap2将应用程序连接到Web服务时,我的Android应用程序崩溃了: 我的错误日志如下:

2-05 12:48:05.100: E/dalvikvm(749): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.example.mytestws.MainActivity.onCreate
12-05 12:48:05.100: W/dalvikvm(749): VFY: unable to resolve new-instance 548 (Lorg/ksoap2/serialization/SoapObject;) in Lcom/example/mytestws/MainActivity;
12-05 12:48:05.100: D/dalvikvm(749): VFY: replacing opcode 0x22 at 0x0012
12-05 12:48:05.100: D/dalvikvm(749): VFY: dead code 0x0014-0057 in Lcom/example/mytestws/MainActivity;.onCreate (Landroid/os/Bundle;)V
12-05 12:48:05.250: D/AndroidRuntime(749): Shutting down VM
12-05 12:48:05.250: W/dalvikvm(749): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-05 12:48:05.261: E/AndroidRuntime(749): FATAL EXCEPTION: main
12-05 12:48:05.261: E/AndroidRuntime(749): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
12-05 12:48:05.261: E/AndroidRuntime(749):  at com.example.mytestws.MainActivity.onCreate(MainActivity.java:29)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.os.Looper.loop(Looper.java:123)
12-05 12:48:05.261: E/AndroidRuntime(749):  at android.app.ActivityThread.main(ActivityThread.java:4627)
12-05 12:48:05.261: E/AndroidRuntime(749):  at java.lang.reflect.Method.invokeNative(Native Method)
12-05 12:48:05.261: E/AndroidRuntime(749):  at java.lang.reflect.Method.invoke(Method.java:521)
12-05 12:48:05.261: E/AndroidRuntime(749):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-05 12:48:05.261: E/AndroidRuntime(749):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-05 12:48:05.261: E/AndroidRuntime(749):  at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:1)

您必须将ksoap2库作为外部库添加到类路径中,并将.jar复制到项目的libs文件夹中。