我有一个现有的 Nativescript angular 应用程序,可以在我的 Android 模拟器上运行,没有任何问题。前几天,我使用以下命令将 tns-android 版本从 4.1.3 更新到 5.0.0:
tns platform update android
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用以下命令再次运行模拟器
tns run android --bundle
Run Code Online (Sandbox Code Playgroud)
但是,由于以下错误,自更新以来我一直无法使应用程序运行:
error: resource xml/network_security_config (aka org.nativescript.app:xml/network_security_config) not found.
Run Code Online (Sandbox Code Playgroud)
我的 AndroidManifest.xml 看起来像这样:
<application
android:name=...
android:debuggable="true"
android:networkSecurityConfig="@xml/network_security_config">
...
</application>
Run Code Online (Sandbox Code Playgroud)
我有一个位于 /App_Resouces/Android/xml 的 network_security_config.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
Run Code Online (Sandbox Code Playgroud)
我尝试删除平台并再次添加它,但发生了同样的错误。我还尝试删除平台并安装特定版本的 android 平台,但仍然没有运气。
当我检查我的 git 历史时,我可以看到 repo 中唯一被跟踪的文件是 package.json 文件。我尝试恢复到我知道有效的最后一次提交,但仍然看到相同的错误。
之前
"tns-android": {
"version": "4.1.3"
}
Run Code Online (Sandbox Code Playgroud)
更新后
"tns-android": {
"version": "5.0.0"
}
Run Code Online (Sandbox Code Playgroud)
让我的构建工作的唯一方法是从 …