My code is working on android KitKat but it when running it in Pie gives io exception
Cleartext http traffic to server.com not permitted
First step is understanding why Google enforces you to use HTTPS. You can read more about it on the developers page.
As for how to fix it, there are two options:
1) Use HTTPS!
2) Create a new file in your XML folder named security_config.xml
and add this:
then in your Manifest file add this
For obvious reasons, the second point is not recommended!