我有问题。 当我将Android SDK工具更新到版本17并将ADT更新为17时,我不能再使用ksoap2了。
我启动应用程序并收到此错误:
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)
我应该使用一些数字来获取String,但我得到了这个错误。
我正在使用ksoap2-2.5.4.jar并尝试了新的ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar。 我正在使用Eclipse indigo,Ubuntu 11.04。
代码如下所示:
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();
感谢您的帮助。
答案 0 :(得分:4)
Android SDK工具到版本17,ADT到17,他们更改了lib结构more details。
以下是修复:
删除“ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar”
来自构建路径。
将jar文件复制到libs文件夹
(如果不存在则创建它),然后从您的文件夹中删除jar文件(如果您的项目中有自定义jar文件夹)。
它会自动将其带入构建路径。然后,清理项目并运行。