There is an error when you try to connect to a HTTP server.
Cannot send data to the server java.net.UnknownServiceException: CLEARTEXT communication to [HOST] not permitted by network security policy
Starting from Android 8, there is a special security policy which requires connection via HTTPS protocol instead of HTTP. So, if you use HTTP, the system shows the error.
There are 2 methods to address this issue.
One is to use HTTPS instead HTTP. Nowadays, most online services is secured behind SSL so it is normal to use HTTPS.
The other method is to add an exception to the security policy.
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:usesCleartextTraffic="true" android:theme="@style/AppTheme"> ... </application>
true allows HTTP connection.