离子网络安全配置 [英] Ionic network security config

查看:72
本文介绍了离子网络安全配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在从事离子应用.通过执行此命令 ionic cordova build android --prod --release .它会生成未分配的apk文件,但也会在network_security_config文件中显示错误.

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.

错误app \ src \ main \ res \ xml \ network_security_config.xml:4:错误:缺少includeSubdomains属性[NetworkSecurityConfig]< domain>本地主机</domain>

我尝试了多种解决方案,但不适用于我.

i tried multiple solutions, but doesn't work for me.

参考

如何允许Android(9)Pie中的所有网络连接类型为HTTP和HTTPS?

Cordova如何支持网络安全配置是Android 7.0吗?

有人可以帮我吗?

推荐答案

转到 resources/android/xml/network_security_config.xml 并添加 includeSubdomains ="true" 域属性.应该是这样的:

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>

这篇关于离子网络安全配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆