您好,我正在从事离子应用。执行此命令ionic cordova build android --prod --release
。它确实会生成未分配的apk文件,但也会在network_security_config文件中显示错误。
错误
app\src\main\res\xml\network_security_config.xml:4: Error: Missing includeSubdomains attribute [NetworkSecurityConfig]
<domain>localhost</domain>
我尝试了多种解决方案,但不适用于我。
参考
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?
有人可以帮我吗?
答案 0 :(得分:1)
转到platforms/android/xml/network_security_config.xml
并将includeSubdomains="true"
添加到domain属性。应该是这样的:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>