简体   繁体   中英

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

App crashing on Android Lollipop when calling web service using ksoap.

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.

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.
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. 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. See " 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. From the stacktrace it looked obvious someone in HTC thought it would be a good idea to include ksoap2. Unfortunately they didn't think this through and made the same mistake as Google with Apache Commons and HttpClient.

To rename the package I used jarjar and it seems to work fine.

For anyone needing a quick solution here are the jarjar rules and commandline:

rules.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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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