问题
I am integrating payUmoney with my app. For android above 9 cleartextTrafficPermitted="false" by default. So I get the following error -
The webpage at hhtp://180.179.174.15:3000/pgSimulator/axis/redirect could not be loaded because: net::ERR_CLEARTEXT_NOT_PERMITTED
So in network_secrity_config.xml, I change it to true as below--
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true"/>
</network-security-config>
And now Android studio shows
Setting <base-config cleartextTrafficPermitted="true"/> is not recommended.
Now is it safe to set it to false? If I don't set it to false. PayUmoney does not work. So what to do now?
回答1:
Either use
<application
...
android:usesCleartextTraffic="true">
....
</application>
Or set config like below with domain:
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">Your_domain</domain>
</domain-config>
</network-security-config>
来源:https://stackoverflow.com/questions/58898140/anroid-studio-warning-setting-base-config-cleartexttrafficpermitted-true