phatpaul
phatpaul

Reputation: 334

Cordova errors resource-file colors.xml missing after clean

I'm am getting this cryptic error when I do:

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

I have narrowed it down to having something to do with this line in my config.xml:

<resource-file src="res/values/colors.xml" target="app/src/main/res/values/colors.xml" />

When the failure occurs, I looked for the presence of colors.xml and it is missing:

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

If I remove that <resource-file line from config.xml, then do:

cordova platform remove android
cordova platform add [email protected]
cordova clean android
cordova prepare android

then the prepare succeeds. (colors.xml is present)

I need to customize those color values, and that line is exactly as recommended in the official documentation: https://cordova.apache.org/docs/en/12.x/config_ref/images.html#adaptive-icon-with-colors

I'll avoid doing the cordova clean android for now. But this doesn't seem like correct behavior.

Versions: cordova: 12.0.0 ([email protected]) cordova-android: 12.0.1 node: v20.5.1

Upvotes: 0

Views: 118

Answers (0)

Related Questions