Ionic network security config

寵の児 提交于 2021-02-08 09:11:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!