当前位置: 代码迷 >> 综合 >> Android9.0兼容问题-android-async-http.jar调用问题
  详细解决方案

Android9.0兼容问题-android-async-http.jar调用问题

热度:34   发布时间:2024-02-06 18:59:17.0

Android 项目在运行在Android9.0上面的时候  闪退 报错如下

Java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/conn/scheme/SchemeRegistry;

解决办法:

在AndroidManifest.xml文件的application标签里面加入

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

 

另外: 正常是按上面处理问题能解决,但看网友反馈,貌似会说有加上这个可以解决报错问题,但是好像会导致没有网络的问题,可以尝试用以下方法:

解决方法(暂时没遇到,预留处理方法):

参考https://blog.csdn.net/castanea/article/details/81256422

在res下新建一个xml目录 创建名为network_security_config.xml 文件 ,该文件内容如下:

<?xml version="1.0" encoding="utf-8"?><network-security-config><base-config cleartextTrafficPermitted="true" /></network-security-config>

然后在 AndroidManifest.xml application 标签内应用上面的xml配置:

android:networkSecurityConfig="@xml/network_security_config"

完!!!

  相关解决方案