简体   繁体   English

使用 OS Lollipop 进行 Web 服务调用时,设备 HTC M8 上的应用程序崩溃

[英]App crash on device HTC M8 with OS Lollipop for web service call

App crashing on Android Lollipop when calling web service using ksoap.使用 ksoap 调用 Web 服务时,Android Lollipop 上的应用程序崩溃。

Please see error log请看错误日志

java.lang.NoSuchFieldError: No instance field headerOut of type [Lorg/kxml2/kdom/Element; in class Lorg/ksoap2/serialization/SoapSerializationEnvelope; or its superclasses (declaration of 'org.ksoap2.serialization.SoapSerializationEnvelope' appears in /system/framework/wifi-service.jar)
at com.-----.---------.-----.----.services.AuthenticateUser.createHeader(AuthenticateUser.java:77)
at com.-----.---------.-----.----.services.AuthenticateUser.authenticateUser(AuthenticateUser.java:49)
at com.-----.---------.-----.----.services.---------GenericServiceThread.callWS(GenericServiceThread.java:219)
at com.-----.---------.-----.----.services.---------GenericServiceThread.invokeWebServiceApi(GenericServiceThread.java:106)
at com.-----.---------.-----.----.services.---------GenericServiceThread.run(GenericServiceThread.java:89)

I have tested same app on Nexus 4 emulator of Android version 5.0 and is working fine.我已经在 Android 5.0 版的 Nexus 4 模拟器上测试了相同的应用程序并且运行良好。

I am using below code for calling webservice我正在使用下面的代码来调用网络服务

mHttpTransportSE = new AndroidHttpTransport (url);
mHttpTransportSE.debug = true; // this is optional, use it if you don't
mHttpTransportSE.call(Configuration.COM_SOAP_ACTION_AUTHENTICATEUSER, envelope);
result = envelope.getResponse();

I have also change AndroidHttpTransport to HttpTransportSE but not sure for that.我也将 AndroidHttpTransport 更改为 HttpTransportSE 但不确定。
Is this change resolve my problem?此更改是否解决了我的问题?
Is any other solution for this problem?这个问题还有其他解决方案吗?

Thank you in advance.先感谢您。

I solved it by changing ksoap2 package name to ksoap2clone.我通过将 ksoap2 包名称更改为 ksoap2clone 来解决它。 I don't know the solution is good but it's now working.我不知道解决方案是好的,但它现在正在工作。 Please share, if you find better solution.如果您找到更好的解决方案,请分享。

File is here.文件在这里。

Same problem here.同样的问题在这里。 Looks like HTC is using their own ksoap2.看起来HTC正在使用他们自己的ksoap2。 See " https://code.google.com/p/ksoap2-android/issues/detail?id=205&can=1&start=200 "请参阅“ https://code.google.com/p/ksoap2-android/issues/detail?id=205&can=1&start=200

I have the same problems (HTC M8), but I'm using ksoap2 3.4.0 jar with dependencies.我有同样的问题(HTC M8),但我使用的是带有依赖项的 ksoap2 3.4.0 jar。 From the stacktrace it looked obvious someone in HTC thought it would be a good idea to include ksoap2.从堆栈跟踪来看,很明显 HTC 中有人认为包含 ksoap2 是个好主意。 Unfortunately they didn't think this through and made the same mistake as Google with Apache Commons and HttpClient.不幸的是,他们没有考虑清楚这一点,并在 Apache Commons 和 HttpClient 上犯了与 Google 相同的错误。

To rename the package I used jarjar and it seems to work fine.要重命名我使用的jarjar包,它似乎工作正常。

For anyone needing a quick solution here are the jarjar rules and commandline:对于需要快速解决方案的任何人,这里是 jarjar 规则和命令行:

rules.txt规则.txt

rule org.ksoap2.** org.repackage.ksoap2.@1

command line命令行

java -jar jarjar.jar process rules.txt ksoap2-android-assembly-3.4.0-jar-with-dependencies.jar ksoap2-repackaged.jar

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

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