1.android:usesCleartextTraffic

这个是在AndroidManifest.xml里的application标签的一个属性,用于配置明文密文请求管理

 

2.targetSdkVersion

目标API级别为27或更低的应用程序的默认值为“ true”。面向API级别28或更高级别的应用默认为“ false”

 

3.这个值会影响webview的拍照获取,设置为true时才能正确选取,false时暂时不知道如何处理

 

4.配置文件res/xml/network_security_config.xml

这个文件用于配置被允许访问的ip地址,这些ip地址上的服务可以使用http,而无需配置https

<?xml version="1.0" encoding="utf-8"?> <network-security-config> 
    <domain-config cleartextTrafficPermitted="true"> 
    <domain includeSubdomains="true">www.pgyer.com</domain> 
    <domain includeSubdomains="true">app-global.pgyer.com</domain> 
    <domain includeSubdomains="true">125.74.75.9</domain> 
    <domain includeSubdomains="true">61.178.24.16</domain> 
    <domain includeSubdomains="true">61.178.24.20</domain> 
    <domain includeSubdomains="true">61.178.24.17</domain> 
    <domain includeSubdomains="true">221.182.241.194</domain> 
    <domain includeSubdomains="true">192.168.0.105</domain> 
    <domain includeSubdomains="true">122.192.9.52</domain> 
    <domain includeSubdomains="true">vfjupz.natappfree.cc</domain> 
    </domain-config>
</network-security-config>

这个xml同样要配置在AndroidManifest.xml里的application标签里

android:networkSecurityConfig="@xml/network_security_config"

<application 
    android:name=".context.AppApplication" 
    android:allowBackup="false" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name"             
    android:networkSecurityConfig="@xml/network_security_config"                         
    android:roundIcon="@mipmap/ic_launcher" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme" 
    android:usesCleartextTraffic="true" 
    tools:replace="android:allowBackup"> 
</application>

 

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐