This problem is similar to the problem: Android: how to fix: No Network Security Config specified, using platform default
This occurs to the api 28 and above, because doesn’t accept http anymore, you need to change if you want to accept http or localhost requests.
Solution:
Step 1:
In Android Manifiest
, in tag application add:
android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config"
Step 2:
create in folder app\src\main\res\xml
this file network_security_config.xml
and write this:
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true" /> </network-security-config>