运行项目遇到以下问题:
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。