简体   繁体   English

Cordova - 解析“config.xml”失败

[英]Cordova - Parsing of “config.xml” Fails

I am currently unable to install Crosswalk and/or run builds using Cordova because Cordova keeps looking for the config.xml file in the wrong location.我目前无法使用 Cordova 安装 Crosswalk 和/或运行构建,因为 Cordova 一直在错误的位置寻找 config.xml 文件。

Steps to reproduce:重现步骤:

cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add android
cordova plugin add cordova-plugin-crosswalk-webview

Error: Unhandled "error" event. (Parsing 
/cordova/platforms/android/res/xml/config.xml failed)

Note: this path doesn't exist.注意:此路径不存在。

The correct path according to the directory/file structure should be:根据目录/文件结构的正确路径应该是:

/cordova/platforms/android/app/src/main/res/xml/config.xml

Is there any way to change the path that Cordova looks for the config.xml file?有什么方法可以更改 Cordova 查找 config.xml 文件的路径?


Cordova: 8.0.0科尔多瓦:8.0.0

Gradle 4.4.1摇篮 4.4.1

Ubuntu 16.04.3 LTS Ubuntu 16.04.3 LTS

Node: 8.9.3节点:8.9.3

NPM: 5.6.0净资产管理:5.6.0

In my case I did the following:就我而言,我执行了以下操作:

ionic cordova platform rm android --save
ionic cordova platform add android@6.4.0 --save

I made a fix here , seems to work.我在这里做了一个修复,似乎有效。 Not sure if cordova or cordova-android have recently changed the locations不确定cordova 或cordova-android 最近是否更改了位置

In my case,就我而言,

I incorrectly added GTM resource-file into config.xml like this:我错误地将 GTM 资源文件添加到 config.xml 中,如下所示:

<platform name="android">
     <resource-file src="GTM-XXXXXXX.json" target="assets/containers/GTM-XXXXXXX.json" />

I knew because I noticed after saving config.xml, the preview of the file changed to unknown.我知道是因为我在保存 config.xml 后注意到,文件的预览变成了未知。 So, I just removed所以,我刚刚删除

<platform name="android">

and moved并移动

<resource-file src="GTM-XXXXXXX.json" target="assets/containers/GTM-XXXXXXX.json" />

to under

<engine name="android"/>

and the problem solved.问题解决了。

就我而言,config.xml 中存在逻辑错误 检查您的 config.xml 是否在描述资源时犯了任何逻辑错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM