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.

Mukesh
  • 402
  • 4
  • 19

3 Answers3

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.

Muzaffer
  • 1,457
  • 1
  • 13
  • 22
  • Thanks wisemann, This is working on other devices. But not tested on HTC M8 because I don't have HTC M8 device. – Mukesh Feb 09 '15 at 10:12
  • @Vishal Khakhkhar : Have you tested same ksoap2clone.jar on HTC M8 by changing package name? or HTC resolved this issue. – Mukesh Feb 16 '15 at 14:05
  • 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 classes – Vishal Khakhkhar Feb 16 '15 at 14:44
  • @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? – Mukesh Feb 17 '15 at 05:52
  • 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.. – Vishal Khakhkhar Feb 17 '15 at 07:07
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"

reiso
  • 1
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
MatPag
  • 41,742
  • 14
  • 105
  • 114
vladimir123
  • 484
  • 6
  • 12