Android development error: java.net.UnknownServiceException: CLEARTEXT communication to 192.xxx.xx not permitt

When Android O is upgraded to P (8.0 to 9.0), the following exception will be reported

HTTP FAILED: java.net.UnknownServiceException: CLEARTEXT communication to 192.xxx.x.x not permitted

Because Android P prohibits access to http APIs by default, if you want to skip https restrictions, you need to AndroidManifest.xmladd the following content to the Application.

<application
	...
    android:usesCleartextTraffic="true"
    ...
/> 

Before adding:
Insert image description here
After adding:
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_74239923/article/details/134691622