Existing color definitions in colors.xml get overriden #436
Closed
Description
Bug report
CHECKLIST
-
I have read the issue reporting guidelines
-
I confirm this is a suspected bug or issue that will affect other users
- I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
- I have read the documentation thoroughly and it does not help solve my issue.
- I have checked that no similar issues (open or closed) already exist.
Current behavior:
Running prepare for Android platform overrides colors.xml by removing everything in it and adding only the Accent color required by this plugin.
Expected behavior:
The plugin after prepare script actually tries not to override existing colors but instead adding the accent one, but it fails because of a wrong condition check.
Steps to reproduce:
- Clone test project.
- Manually define custom colors in colors.xml Android file.
- Run cordova prepare Android
- Check colors.xml file contents. Step 2 colors are gone.
Screenshots
Environment information
- Cordova CLI version
- 9.0.0 (cordova-lib@9.0.1)
- Cordova platform version
- android 8.1.0
- Dev machine OS and version, e.g.
- OSX
- 10.15.3
- OSX
Related code:
The issue is specifically in after_prepare.js line #131:
if($resources.color && $resources.color._text) {
As $resources.color is an array, $resources.color._text is always undefined/false.
Other information:
Issue was introduced as part of: #284