我在啓用了maven的android項目中使用了Ksoap2版本2.5.4。到KSOAP特定類的任何引用拋出此異常在使用ksoap2庫時出現異常android
04-18 20:35:15.429: ERROR/dalvikvm(626): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.rare.Main.fetchSoapResponse
04-18 20:35:15.662: ERROR/AndroidRuntime(626): FATAL EXCEPTION: main
04-18 20:35:15.662: ERROR/AndroidRuntime(626): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at com.rare.Main.fetchSoapResponse(Main.java:57)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at com.rare.Main.onCreate(Main.java:23)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.os.Handler.dispatchMessage(Handler.java:99)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.os.Looper.loop(Looper.java:123)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at java.lang.reflect.Method.invokeNative(Native Method)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at java.lang.reflect.Method.invoke(Method.java:507)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-18 20:35:15.662: ERROR/AndroidRuntime(626): at dalvik.system.NativeStart.main(Native Method)
的代碼行導致這
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
找不到與此相關的SO或其他論壇的任何幫助。這看起來非常簡單。任何人都可以告訴我缺少什麼以及如何讓android在運行時使用庫。
你有沒有下載['...- JAR-與-dependencies.jar'(http://code.google.com/p/ksoap2-android/source/browse/ m2-repo/com/google/code/ksoap2-android/ksoap2-android-assembly/2.5.4 /)版本?你有沒有添加到構建路徑的外部jar? – bigstones 2011-04-18 22:08:46
如果我添加外部庫,我得到這個錯誤信息'轉換爲Dalvik格式失敗,錯誤1' – Manoj 2011-04-19 14:37:58
我的工作步驟是:右鍵單擊項目 - >構建路徑 - >添加外部檔案。 – bigstones 2011-04-19 18:21:24