No resource found that matches the given name (at 'networkSecurityConfig' with value '@xml/network_s

  • 时间:
  • 来源:互联网
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/lucasxt/article/details/103295068

执行命令
cordova build android
错误提示No resource found that matches the given name (at ‘networkSecurityConfig’ with value '@xml/network_s
解决方法
项目根目录\platforms\android\res\xml
添加文件network_security_config.xml(名字自定义)

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

找到文件项目根目录\platforms\android\AndroidManifest.xml
添加android:networkSecurityConfig="@xml/network_security_config"

 <application 
 ...
android:networkSecurityConfig="@xml/network_security_config" 
...>

    </application>

本文链接http://element-ui.cn/news/show-361.aspx