fluttercommunity / fluttercommunity/flutter_launcher_icons

[BUG] Image path written to colors.xml instead of hex color when using adaptive_icon_background with image

Open
#665 2 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Dart
Stars
2.1k
Forks
426
PR merge metrics
No merged PRs in 30d

Description

### :information_source: Info

- flutter_launcher_icons version: 0.14.4
- Flutter version: 3.38.9
- Dart version: 3.10.8

### :speech_balloon: Description

When using an **image path** for `adaptive_icon_background`, the package incorrectly writes the raw image path into `android/app/src/main/res/values/colors.xml`.

**Problem:**
The `` tag in Android XML resources only accepts hex color values, not file paths. This causes the build to fail with:

Invalid for given resource value.
FAILURE: Build failed with an exception.
Execution failed for task ':app:mergeDebugResources'.
Resource compilation failed

**Generated colors.xml (incorrect):**
```xml
assets/images/background.jpg
Expected colors.xml:

#FFFFFF
Note: The adaptive icon images ARE correctly generated in mipmap-* folders. Only the colors.xml entry is wrong.

Workaround: Manually replace the image path in colors.xml with a hex color value.

:scroll: Pubspec.yaml

flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/logo3.jpg"
remove_alpha_ios: true
adaptive_icon_background: "assets/images/background.jpg"
adaptive_icon_foreground: "assets/images/foreground.png"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.