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

3

14

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.

Monck answered 5/2, 2015 at 8:42 Comment(4)
Did you check on any other device? Is this lollipop specific crash?Thackeray
I have not tested on device with OS lollipop.Monck
Can you try my solution?Laughing
@FlamePrincessϡ : I have tested on device Moto G2 with Android Lollipop and its work fine. No crash on Moto G2Monck
L
7

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.

Laughing answered 6/2, 2015 at 16:57 Comment(5)
Thanks wisemann, This is working on other devices. But not tested on HTC M8 because I don't have HTC M8 device.Monck
@Vishal Khakhkhar : Have you tested same ksoap2clone.jar on HTC M8 by changing package name? or HTC resolved this issue.Monck
No HTC didn't resolved Issue yet.. I've used this new ksoap2clone.jar and it worked.. but it doesn't seems solutions as each and every time I'll have to rename my ksoap2 classesHanson
@VishalKhakhkhar :Thank you for update. As per your comment, Is this solution not good for HTC? and What means rename my ksoap2 classes every time?Monck
currently I was using ksoap2 ver3.3.3.. n latest version is 3.3.4 available.. now whenever ksoap is releasing update at that time I'll need to compare class and put the code and create or use that libs again by renaming package..Hanson
M
0

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"

Maleficent answered 6/2, 2015 at 11:44 Comment(3)
I disagree that this does not answer it. It's the correct answer - the problem lies in HTC's implementation of ksoap2, and hence has no answer. It might have alternatives.Myall
i agree with hnilsen. i'll try to change ksoap2 package name.Laughing
I'm also agree with hnilsenMonck
H
0

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
Holbert answered 28/4, 2015 at 11:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.