java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/message/BasicNameValuePair;
at id.mania.pinja.obtaindata.ObtainUploadPackageDataTask.onSetup(ObtainUploadPackageDataTask.java:53)
at id.mania.pinja.network.engine.OkHttpEngine.setupHttpTask(OkHttpEngine.java:182)
at id.mania.pinja.network.engine.OkHttpEngine.executeHttpTask(OkHttpEngine.java:352)
at id.mania.pinja.network.engine.OkHttpEngine.access$000(OkHttpEngine.java:35)
at id.mania.pinja.network.engine.OkHttpEngine$TaskRunnable.run(OkHttpEngine.java:653)
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)
出现此问题主要是 apache 的 http 库在android 9.0删除导致的,出现此问题应该是使用了 apache 的http库。
修复:
我实在application加上
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
最后建议尽量不要再使用httpClient来访问网络,替换成HttpURLConnection或者OKHttp。
网友评论