Android 开发知识

Android9.0踩坑

2019-01-10  本文已影响0人  hahauha

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"
...
    />

适配相关:

android7.0:https://www.jianshu.com/p/470359cbfb78
android8.0:https://www.jianshu.com/p/96b7b39dcc9c
android9.0:https://www.jianshu.com/p/9415f83df810

上一篇下一篇

猜你喜欢

热点阅读