apache / apache/cordova-android

Cordova Android doesn't work with resource references

Open
#1,727 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
1.6k
Avg merge
16h 18m
Merged PRs (30d)
11

Description

# Bug Report

## Problem
The documentation is unclear. And I tried ChatGPT too. I have this config.xml in the cordova project root.

```xml
































```

In the project root I have the `res` folder:
Screenshot 2024-07-31 at 10 42 27

Which contains the assets that match the `resource-file` elements in the `config.xml` but they are not copied into the target folders.

### What is expected to happen?
I want to define: colors.xml, splash.xml, foreground.xml and monochrome.xml in my project root `res` folder and then have those copied across into the android platform as appropriate.

### What does actually happen?
causes an error:
```
Android project created with cordova-android@13.0.0
Source path does not exist: @drawable/ic_launcher_foreground
```

## Information

### Command or Code

`cordova platform remove android; cordova platform add android;`

### Environment, Platform, Device

I'm running cordova on Mac OS X and trying to build it for Android API v13 for emulator.

### Version information

Cordova: 12.0.0 (cordova-lib@12.0.1)
cordova-android@13.0.0
Mac OS X: 14.5 (23F79)
Android Studio Koala | 2024.1.1 Patch 1
Node: v20.15.1

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start with the supplied config.xml and reproduce using `cordova platform remove android; cordova platform add android;` on cordova-android@13.0.0, focusing on the resource-file and adaptive icon entries. Check the documented resource handling and platform-creation behavior for whether @drawable references can resolve from project-root files. Done means the configuration behaves as documented or the supported configuration and regression coverage are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.