Skip to content

Existing color definitions in colors.xml get overriden #436

Closed
@ajberasategui

Description

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the 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:

  1. Clone test project.
  2. Manually define custom colors in colors.xml Android file.
  3. Run cordova prepare Android
  4. 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

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

Metadata

Assignees

No one assigned

    Labels

    androidRelates to Android platformbugSomething isn't working properly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions