fluttercommunity / fluttercommunity/flutter_launcher_icons

iOS icon generation fails with custom xcodeproj path when using flavors

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

Description

## Description
When using flavor-specific launcher icons with a custom `xcodeproj_path`, the tool fails to update the project file despite following the documented flavor configuration pattern (`flutter_launcher_icons-.yaml`).

## Steps to Reproduce
1. Create a Flutter project with flavors (dev, hml, prod) and custom iOS project name
2. Create flavor-specific icon configuration files following the documentation pattern:

Example `flutter_launcher_icons-hml.yaml`:
```yaml
flutter_launcher_icons:
android: true
ios: true
image_path: "assets/icons/ic_launcher_hml.png"
remove_alpha_ios: true
xcodeproj_path: "ios/MyApp.xcodeproj"
```

3. Run the flavor-specific command:
```bash
flutter pub get
dart run flutter_launcher_icons -f flutter_launcher_icons-hml.yaml
```

## Current Behavior
The tool:
1. Successfully generates the flavor-specific icons in Assets.xcassets
2. Fails with path error, still looking for default Runner.xcodeproj:

```
✓ Successfully generated launcher icons
Unhandled exception:
PathNotFoundException: Cannot open file, path = 'ios/Runner.xcodeproj/project.pbxproj' (OS Error: No such file or directory, errno = 2)
```

## Expected Behavior
The tool should:
1. Generate the flavor-specific icons (currently working)
2. Use the specified `xcodeproj_path` for project file updates
3. Successfully complete the flavor-specific icon update process

## Environment
- Flutter version: 3.19.0
- flutter_launcher_icons version: 0.14.3
- Operating System: macOS Sonoma 14.3.1

## Additional Context
- The documentation explicitly supports flavors through `flutter_launcher_icons-.yaml` files
- Icon generation works correctly for flavors
- The issue appears specific to project file updates when using both flavors and custom xcodeproj paths
- Project structure follows Flutter flavor best practices with separate configurations for dev, hml, and prod environments

## Related Documentation
From the official documentation:
> Create a Flutter Launcher Icons configuration file for your flavor. The config file is called flutter_launcher_icons-.yaml by replacing by the name of your desired flavor.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the flavor entry point `dart run flutter_launcher_icons -f flutter_launcher_icons-hml.yaml` and the documented `flutter_launcher_icons-.yaml` configuration, focusing on how `xcodeproj_path: "ios/MyApp.xcodeproj"` is used during project updates. Reproduce the failure and inspect the attempted `ios/Runner.xcodeproj/project.pbxproj` path; done means the custom project file is updated and the command completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, ios
Domain
mobile, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.