Early in the morning is a business group @, online App encountered a problem:
prompt: net :: ERR_CLEARTEXT_NOT_PERMITTED
Before are not the problem, what is the problem? Android SDK upgrade should have guessed that the cause was right, Stackoverflow look, sure enough.
Starting Android 9.0 (API level 28), by default limits the network traffic in clear text request for unencrypted traffic no longer trust, to give up direct request, the url http therefore are not loaded in the webview, https is not affected.
Unlock correct posture
First, ensure network rights affirmed App
<uses-permission android:name="android.permission.INTERNET" />
Solution (1):
Application of a switch in the open
<manifest ...>
<application
...
android:usesCleartextTraffic="true"
...>
...
</application>
</manifest>
Solution (2):
res under the new xml directory, create a file: network_security_config.xml, reads as follows:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
Add a profile in the application of the label AndroidManifest.xml:
<manifest ...>
<application
...
android:networkSecurityConfig="@xml/network_security_config"
...>
...
</application>
</manifest>
Solution (3): [Recommended]
Server and local applications use https
Solution (4):
targetSdkVersion downgrade back to 27
Traffic on the network policy more explicitly reference configurations bring their own ladders google official website .