简体   繁体   English

更新Android SDK和ADT后出现Ksoap2错误

[英]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. 当我将Android SDK工具更新到版本17并将ADT更新为17时,我不能再使用kso​​ap2了。

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. 我应该用一些数字得到String但是我得到了这个错误。

I was using ksoap2-2.5.4.jar and tried the new ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar. 我正在使用kso​​ap2-2.5.4.jar并尝试了新的ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar。 I'm using Eclipse indigo, Ubuntu 11.04. 我正在使用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. 谢谢您的帮助。

Android SDK tool to version 17 and the ADT to 17 they changed lib structure more details . Android SDK工具到版本17和ADT到17他们改变了lib结构的更多细节

Here is the fix: 这是修复:

Remove the "ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar" 删除“ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar”

from the build path. 从构建路径。

copy the jar file into libs folder 将jar文件复制到libs文件夹中

(if not exist create it), then remove jar file from your folder(if you have custom jar folder in your project). (如果不存在则创建它),然后从您的文件夹中删除jar文件(如果您的项目中有自定义jar文件夹)。

用于添加新jar文件的文件夹结构

it will automatically take it in the build path.then, clean your project and run. 它将自动将其置于构建路径中。然后,清理项目并运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM