Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
744 views
in Technique[技术] by (71.8m points)

exception while using ksoap2 library for android

I'm using Ksoap2 version 2.5.4 in my maven enabled android Project. Any reference to the Ksoap specific classes is throwing this exception

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)

the line of code causing this is

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 

Couldn't find any help related to this on SO or other forums. This seems pretty straight forward. Can any one tell me whats missing and how I can make android use the library at run time.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  • In your build path clear all libraries (jar files).
  • In project's main directory create a folder and named it "libs" (not "lib").
  • Now Eclipse ADT Plugin will add your jar files to build path.
  • Clean & Build your project if necessary.
  • Happy coding

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...