У меня есть BackgroundTask, который вызывает метод веб-сервиса и возвращает строку в качестве ответа. Я использую протокол HttpTransportSE для вызова SOAP_ACTION. У меня проблема в том, что все работает нормально на Android 9 (P ie) или ранее, но когда мой телефон обновился через несколько дней с go до Android 10, эта часть кода вылетает.
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);
}
catch (IOException | XmlPullParserException e)
{
e.printStackTrace();
}
response = envelope.getResponse();
Я посмотрел журнал отладки и получил это сообщение, объясняющее мою ошибку, и я думаю, что проблема в KXmlSerializer , но я не знаю, как решить проблему.
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.myApp.myApp.myApp, PID: 31124
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:399)
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:289)
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:919)
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.myApp.myApp.Activity_splash_screen_fragment$BackgroundIsTheUserRegistrated.doInBackground(Activity_splash_screen_fragment.java:289)
at com.example.myApp.myApp.Activity_splash_screen_fragment$BackgroundIsTheUserRegistrated.doInBackground(Activity_splash_screen_fragment.java:208)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
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:919)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.kxml2.io.KXmlSerializer" on path: DexPathList[[zip file "/data/app/com.myApp.myApp.myApp-qFqHY1ZB93Aa6uV4aRXMkQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.myApp.myApp.myApp-qFqHY1ZB93Aa6uV4aRXMkQ==/lib/x86, /data/app/com.myApp.myApp.myApp-qFqHY1ZB93Aa6uV4aRXMkQ==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
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.myApp.myApp.Activity_splash_screen_fragment$BackgroundIsTheUserRegistrated.doInBackground(Activity_splash_screen_fragment.java:289)
at com.example.myApp.myApp.Activity_splash_screen_fragment$BackgroundIsTheUserRegistrated.doInBackground(Activity_splash_screen_fragment.java:208)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
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:919)