question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build error 'cannot read property startsWith of undefined' when using adaptive icons

See original GitHub issue

Bug Report

Sample project: test.zip

Extract and run: cordova platform add android cordova prepare android

Problem

It fails with Cannot read property 'startsWith' of undefined.

What is expected to happen?

Successful prepare

What does actually happen?

It fails with an error message

Information

This only happens if you have both a normal and an adaptive icon.

Command or Code

Included above

Environment, Platform, Device

Windows 10 64-bit

Version information

Cordova 9.0.0 (cordova-lib@9.0.1)

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
breautekcommented, Sep 15, 2020

I’m running into the same issue when attempting to build with Adaptive Icons, and the aforementioned workaround in @AshleyScirra 's post (“it looks like a workaround for this is to define the legacy icons below the adaptive icons”) doesn’t work for me either. I’m on a Mac ( 10.15.6 ) with Cordova 9.0.0.

This issue should be fixed in the latest cordova-android release, (currently cordova-android@9.0.0) by https://github.com/apache/cordova-android/pull/1001

If you still have an issue please open a new issue in the cordova-android repo at https://github.com/apache/cordova-android/issues

0reactions
breautekcommented, Sep 18, 2020

@breautek - oh boy. What can I do to resolve this while still on cordova-android@8.1 ? I can’t migrate to @9.0.0 yet as it breaks my app in a few places, and don’t have time to step through it all for a while.

You can try forking cordova-android, branch off the rel/8.1.0 tag and apply the https://github.com/apache/cordova-android/pull/1001 patch. Then you can install the platform over git.

cordova platform add <https://github.com/your/cordova-android-fork#8.1.x-branch

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build error 'cannot read property startsWith of undefined' when ...
Information. This only happens if you have both a normal and an adaptive icon. Command or Code. Included above. Environment, Platform, Device.
Read more >
[GitHub] [cordova-cli] breautek commented on issue #506: Build ...
[GitHub] [cordova-cli] breautek commented on issue #506: Build error 'cannot read property startsWith of undefined' when using adaptive icons.
Read more >
React Native [TypeError: Cannot read property 'startsWith' of ...
finally I have solved the problem by adding string type and :void to filepath instead of any ( i dont know what this...
Read more >
[GitHub] [cordova-android] breautek commented on issue #984
... [cordova-android] breautek commented on issue #984: Build error 'cannot read property startsWith of undefined' when using adaptive icons.
Read more >
org.apache.cordova.issues - 2020 June - 1,776 messages - MarkMail
[GitHub] [cordova-android] breautek commented on issue #984: Build error 'cannot read property startsWith of undefined' when using adaptive icons - GitBox.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found