exception while using ksoap2 library for android
Asked Answered
T

2

6

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.

Triangle answered 18/4, 2011 at 20:39 Comment(3)
Have you downloaded the ...-jar-with-dependencies.jar version? Have you added to the build path the external jar?Rootless
if i add the external library i get this error message 'Conversion to Dalvik format failed with error 1'Triangle
the steps that worked for me are: right click on project -> build path -> add external archives.Rootless
B
16
  • 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
Beamon answered 26/4, 2012 at 8:1 Comment(1)
You missed final step :) Restarting eclipse. Then worked fine https://mcmap.net/q/1632431/-ksop2-librarary-class-not-found-exceptionDesinence
I
1

I had the same problem.I have added ZIP file instead of jar file to external library, you need to add only the JAR file.

Insentient answered 30/10, 2011 at 14:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.