问题
Hello i am working on ionic application. with executing this command ionic cordova build android --prod --release
. it does generate the unasigned apk file,but it also show error in network_security_config file.
Error
app\src\main\res\xml\network_security_config.xml:4: Error: Missing includeSubdomains attribute [NetworkSecurityConfig]
<domain>localhost</domain>
i tried multiple solutions, but doesn't work for me.
Reference
How to allow all Network connection types HTTP and HTTPS in Android (9) Pie?
How Cordova support Network Security Config introduced by Android 7.0?
Could someone help me with this?
回答1:
Go to the resources/android/xml/network_security_config.xml
and add includeSubdomains="true"
to the domain property. It should be like this:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>
来源:https://stackoverflow.com/questions/58608249/ionic-network-security-config