Recently, the app was running in Android 9 On the device , find http There was no response from the network request .

Official information mentioned in framework security change , The address is :
https://developer.android.google.cn/about/versions/pie/android-9.0-changes-28
<https://developer.android.google.cn/about/versions/pie/android-9.0-changes-28>

Network transport layer security protocol is enabled by default (TLS)

If your app uses Android 9 Or later is the target platform , By default  isCleartextTrafficPermitted()
<https://developer.android.google.cn/reference/android/security/NetworkSecurityPolicy.html#isCleartextTrafficPermitted()>
  Function return  false. If your application needs to enable clear text for a specific domain name , You must configure the network security in the application
<https://developer.android.google.cn/training/articles/security-config.html>
For these domain names, the  cleartextTrafficPermitted  Explicitly set to  true.

The specific solution consists of two steps , The references are :
https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie

<https://stackoverflow.com/questions/51902629/how-to-allow-all-network-connection-types-http-and-https-in-android-9-pie>

The first step : In the manifest file AndroidManifest.xml Of application Inside the label networkSecurityConfig The properties are as follows :
<?xml version="1.0" encoding="utf-8"?> <manifest ... > <application
android:networkSecurityConfig="@xml/network_security_config"> <!-- ... -->
</application> </manifest>
Step two : In Resources folder res/xml Create network_security_config.xml as follows :
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config
cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" />
</trust-anchors> </base-config> </network-security-config>