Android9.0 java.lang.ClassNotFoundException: Didn't find class "org.apache.http.params.BasicHttpP...

运行项目遇到以下问题:

JNI DETECTED ERROR IN APPLICATION: JNI CallObjectMethodV called with pending exception java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/params/BasicHttpParams;
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.params.BasicHttpParams" on path: DexPathList

解决方案:

1.在清单文件增加代码:

 <application
      android:usesCleartextTraffic="true">

2.在清单文件清单再加一句代码:

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

好了,重新运行解决了.
最根本的做法是使用https进行接口访问,毕竟涉及数据的安全性。当然了,这需要服务器的支持。还有第三方sdk,也需要使用https。

    原文作者:柴江朋
    原文地址: https://www.jianshu.com/p/342689756022
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞