Search code examples
androidsdkadtksoap2

Ksoap2 Error after Updating Android SDK and ADT


I have a problem. When I updated Android SDK tool to version 17 and the ADT to 17 I can't use ksoap2 any more.

I start the app and get this error:

03-25 20:13:49.995: E/AndroidRuntime(555): FATAL EXCEPTION: main
03-25 20:13:49.995: E/AndroidRuntime(555): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
03-25 20:13:49.995: E/AndroidRuntime(555):  at com.alcad.pernat.praksa.SplashScreen.pridobiDanasnjo(SplashScreen.java:124)
03-25 20:13:49.995: E/AndroidRuntime(555):  at com.alcad.pernat.praksa.SplashScreen.onCreate(SplashScreen.java:73)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.os.Looper.loop(Looper.java:123)
03-25 20:13:49.995: E/AndroidRuntime(555):  at android.app.ActivityThread.main(ActivityThread.java:4627)
03-25 20:13:49.995: E/AndroidRuntime(555):  at java.lang.reflect.Method.invokeNative(Native Method)
03-25 20:13:49.995: E/AndroidRuntime(555):  at java.lang.reflect.Method.invoke(Method.java:521)
03-25 20:13:49.995: E/AndroidRuntime(555):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-25 20:13:49.995: E/AndroidRuntime(555):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-25 20:13:49.995: E/AndroidRuntime(555):  at dalvik.system.NativeStart.main(Native Method)

I should get String with some numbers but instead I get this error.

I was using ksoap2-2.5.4.jar and tried the new ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar. I'm using Eclipse indigo, Ubuntu 11.04.

The code looks like this:

SoapObject Request =new SoapObject(NAMESPACE,METHOD_NAME); // Here I get the error
                    SoapSerializationEnvelope soapEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
                    soapEnvelope.dotNet=false;

                    String tmp=odstejDatum(datum);
                    Request.addProperty("datumod",tmp);
                    Request.addProperty("datumdo",datum);
                    Request.addProperty("tip_lme",1);
                    @SuppressWarnings("deprecation")
                    HttpTransportSE aht=new HttpTransportSE(URL,5000);
                    soapEnvelope.setOutputSoapObject(Request);  
//                  

                    aht.call(SOAP_ACTION_DANASNJI,soapEnvelope);                    
                    Object response= soapEnvelope.getResponse();    

Thanks for the help.


Solution

  • Android SDK tool to version 17 and the ADT to 17 they changed lib structure more details.

    Here is the fix:

    Remove the "ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar"

    from the build path.

    copy the jar file into libs folder

    (if not exist create it), then remove jar file from your folder(if you have custom jar folder in your project).

    folder structure for adding new jar files

    it will automatically take it in the build path.then, clean your project and run.