当我这样做的时候,我会得到这个神秘的错误:
cordova clean android
cordova prepare android
TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('ENOENT')
at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
at /usr/lib/node_modules/cordova/bin/cordova:32:22
我已经将其缩小到与config.xml中的这一行有关:
<resource-file src="res/values/colors.xml" target="app/src/main/res/values/colors.xml" />
当失败发生时,我寻找colors.xml的存在,但它不见了:
root@aaa08cb7ed25:/opt/src/testcordovabug/testcordovabug# ls -la platforms/android/app/src/main/res/values/
total 16
drwxr-xr-x 2 root root 4096 May 17 00:48 .
drwxr-xr-x 17 root root 4096 May 16 23:55 ..
-rw-r--r-- 1 root root 237 May 16 23:55 strings.xml
-rw-r--r-- 1 root root 602 May 16 23:55 themes.xml
如果我移除<从config.xml中的资源文件行,然后执行:
cordova platform remove android
cordova platform add [email protected]
cordova clean android
cordova prepare android
则准备成功。(colors.xml存在)
我需要自定义这些颜色值,这一行与官方文档中的建议完全一致:
https://cordova.apache.org/docs/en/12.x/config_ref/images.html#adaptive-icon-with-colors
我会避免做
cordova clean android
目前。但这似乎不是正确的行为。
版本:
cordova:12.0.0(
[email protected]
)
cordova安卓系统:12.0.1
节点:v20.5.1