Android9.0踩坑

1、闪退,报错如下

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

解决方案:
在AndroidManifest.xml文件的application标签里面加入

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

2、Android 9 Pie:http及https的网络连接问题
解决方案:
(1)在res的xml目录下,新建一个xml文件(名称自定义,如:network_security_config.xml),内容如下:

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

(2)在manifest清单文件配置application:

<application
...
 android:networkSecurityConfig="@xml/network_security_config"
...
    />

喝水不忘挖井人:https://blog.csdn.net/mysimplelove/article/details/84063571

作者:QQ蔓
链接:https://www.jianshu.com/p/9415f83df810
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容