gpt4 book ai didi

java - 显示由 : java. lang.NoClassDefFoundError 错误引起的生产 Android 应用程序

转载 作者:行者123 更新时间:2023-11-29 18:38:18 25 4
gpt4 key购买 nike

生产应用程序如何向用户显示未找到类的错误,但在模拟器上它与 Android 9.0 一起工作得很好。模拟器在编译或构建过程中是否也应该中断或显示错误?

java.lang.RuntimeException:

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)

引起:java.lang.NoClassDefFoundError:

at org.apache.http.impl.client.AbstractHttpClient. (AbstractHttpClient.java:182) at org.apache.http.impl.client.DefaultHttpClient. (DefaultHttpClient.java:150) at com.exposure.utilities.RestClient.executeRequest (RestClient.java:162) at com.exposure.utilities.RestClient.Execute (RestClient.java:127)
at com.exposure.utilities.Utility.getData (Utility.java:162) at com.exposure.utilities.DataTask.doInBackground (DataTask.java:26) at com.exposure.utilities.DataTask.doInBackground (DataTask.java:9) at android.os.AsyncTask$2.call (AsyncTask.java:333) at java.util.concurrent.FutureTask.run (FutureTask.java:266)

引起:java.lang.ClassNotFoundException:

at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134) at java.lang.ClassLoader.loadClass (ClassLoader.java:379) at java.lang.ClassLoader.loadClass (ClassLoader.java:312)

最佳答案

看起来这是因为 http 客户端被弃用了。将以下代码添加到您的 list 应用程序标记中。

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

从 andorid pie 开始,android pie 不再支持 Apache HTTP 客户端,请查看更改日志以供引用 https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p

关于java - 显示由 : java. lang.NoClassDefFoundError 错误引起的生产 Android 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53538452/

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