当前位置: 首页 > 工具软件 > kXML > 使用案例 >

android kxml2,android - Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/kxml2/...

霍永年
2023-12-01

Am using Ksoap2 library to handle soap webservices.But am gettig the error No class def found issues.Can someone please explian what exact the issue is and the solution.I added Ksoap2 jar in libs folder and Right click on it and selected Add as libary option. Below are my codes.

Below is my Gradle:

repositories {

mavenCentral()

maven {

url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/'

}

}

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.android.support:appcompat-v7:28.0.0'

implementation 'com.android.support.constraint:constraint-layout:1.1.3'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'com.android.support.test:runner:1.0.2'

androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation files('libs/ksoap2-android-2.5.2.jar')

}

Below is my webserive hadling code:

SoapObject request = new SoapObject(NAMESPACE,METHOD_GET_PO);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

request.addProperty("uCode", mUCode);

envelope.dotNet = true;// to handle .net services asmx/aspx

envelope.setOutputSoapObject(request);

HttpTransportSE ht = new HttpTransportSE(URL_PROTOCOL+ settings.getSettings_Serverpath() + URL_SERVICE_NAME);

ht.debug = true;

String soap_action = NAMESPACE + METHOD_GET_PO;

ht.call(soap_action, envelope);

SoapPrimitive resultString = (SoapPrimitive) envelope.getResponse();

Am getting the below error:

--------- beginning of crash

2019-07-25 15:55:49.766 12018-12064/com.example.sivabala.visualporeceiving E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1

Process: com.example.sivabala.visualporeceiving, PID: 12018

java.lang.RuntimeException: An error occurred while executing doInBackground()

at android.os.AsyncTask$3.done(AsyncTask.java:354)

at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)

at java.util.concurrent.FutureTask.setException(FutureTask.java:252)

at java.util.concurrent.FutureTask.run(FutureTask.java:271)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:914)

Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/kxml2/io/KXmlSerializer;

at org.ksoap2.transport.Transport.createRequestData(Transport.java:80)

at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:79)

at com.example.sivabala.visualporeceiving.CI.controller.LoginActivity$GetPO.doInBackground(LoginActivity.java:184)

at com.example.sivabala.visualporeceiving.CI.controller.LoginActivity$GetPO.doInBackground(LoginActivity.java:149)

at android.os.AsyncTask$2.call(AsyncTask.java:333)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:914)

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.kxml2.io.KXmlSerializer" on path: DexPathList[[zip file "/data/app/com.example.sivabala.visualporeceiving-yscH3NKMSUtvYDIdp2ANSQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.sivabala.visualporeceiving-yscH3NKMSUtvYDIdp2ANSQ==/lib/x86, /system/lib, /system/product/lib]]

at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:195)

at java.lang.ClassLoader.loadClass(ClassLoader.java:379)

at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

at org.ksoap2.transport.Transport.createRequestData(Transport.java:80)

at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:79)

at com.example.sivabala.visualporeceiving.CI.controller.LoginActivity$GetPO.doInBackground(LoginActivity.java:184)

at com.example.sivabala.visualporeceiving.CI.controller.LoginActivity$GetPO.doInBackground(LoginActivity.java:149)

at android.os.AsyncTask$2.call(AsyncTask.java:333)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:914)

 类似资料: