gpt4 book ai didi

java - android 9 中的错误 protected doInBackground

转载 作者:行者123 更新时间:2023-12-01 19:50:21 25 4
gpt4 key购买 nike

我在 Android 9 上使用这些代码时遇到问题(在较低版本中工作正常)

立即退出并出现以下错误

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
Process: com.banehmall.application, PID: 2092
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:764)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/bind/DatatypeConverter;
at org.scribe.services.DatatypeConverterEncoder.encode(DatatypeConverterEncoder.java:10)
at org.scribe.services.HMACSha1SignatureService.bytesToBase64String(HMACSha1SignatureService.java:51)
at org.scribe.services.HMACSha1SignatureService.doSign(HMACSha1SignatureService.java:46)
at org.scribe.services.HMACSha1SignatureService.getSignature(HMACSha1SignatureService.java:32)
at org.scribe.oauth.OAuth10aServiceImpl.getSignature(OAuth10aServiceImpl.java:151)
at org.scribe.oauth.OAuth10aServiceImpl.addOAuthParams(OAuth10aServiceImpl.java:75)
at org.scribe.oauth.OAuth10aServiceImpl.signRequest(OAuth10aServiceImpl.java:126)
at com.ciyashop.library.apicall.PostApi$postAPiCall.doInBackground(PostApi.java:109)
at com.ciyashop.library.apicall.PostApi$postAPiCall.doInBackground(PostApi.java:40)
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:764) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.bind.DatatypeConverter" on path: DexPathList[[zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/base.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_dependencies_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_resources_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_0_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_1_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_2_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_3_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_4_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_5_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_6_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_7_apk.apk", zip file "/data/app/com.banehmall.application-5XvyXjUfi1L5D2K7385M5A==/split_lib_slice_8_apk.apk", zip file "/data/app/com.banehmall.application-.

。.

添加此 (commons-codec:commons-codec:1.10) 库后,应用程序可以正常工作,但未从服务器接收到数据,并且此日志

E/Exception is: There was a problem while creating a connection to the remote service.
E/EGL_emulation: tid 2357: eglSurfaceAttrib(1354): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xeb2e4dc0, error=EGL_BAD_MATCH
E/EGL_emulation: tid 2357: eglSurfaceAttrib(1354): error 0x3009 (EGL_BAD_MATCH)
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xeb2e4e20, error=EGL_BAD_MATCH
E/getHomeDataResponse is: OAuthConnectionException
E/getHomeDataGson Exception is: Value OAuthConnectionException of type java.lang.String cannot be
converted to JSONObject
I/OpenGLRenderer: Davey! duration=899ms; Flags=0, IntendedVsync=1587234779362, Vsync=1587568112682,
OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1587582802287,
AnimationStart=1587582869695, PerformTraversalsStart=1587582992031, DrawStart=1587644518429,
SyncQueued=1587720147467, SyncStart=1587740410691, IssueDrawCommandsStart=1587740635430,
SwapBuffers=1588088691627, FrameCompleted=1588154607644, DequeueBufferDuration=199000,
QueueBufferDuration=417000,

非常感谢你

最佳答案

嗨,我找到了这个问题的解决方案。在 Android 9(28 及更高版本)中使用 HTTPS,如果您的服务器使用 HTTP,则会发生此错误。答案是在 list 中编写以下代码

<application
.
.
.
android:usesCleartextTraffic="true">
<uses-library android:name="org.apache.http.legacy" android:required="false" />

如果不起作用,请使用无效缓存/重新启动

关于java - android 9 中的错误 protected doInBackground,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59091614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com