Closed jerwin-fernandez closed 1 year ago
I have the same problem, and I just upgraded flutter. Maybe flutter_launcher_icons is not compatible with the latest flutter version?
Below is my flutter doctor -v
[✓] Flutter (Channel stable, 3.13.5, on Ubuntu 23.04 6.2.0-33-generic, locale en_US.UTF-8)
• Flutter version 3.13.5 on channel stable at /home/wiky/local/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 12fccda598 (5 days ago), 2023-09-19 13:56:11 -0700
• Engine revision bd986c5ed2
• Dart version 3.1.2
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /home/wiky/local/android-sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /home/wiky/local/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 15.0.7
• cmake version 3.25.1
• ninja version 1.11.1
• pkg-config version 1.8.1
[✓] Android Studio (version 2022.3)
• Android Studio at /home/wiky/local/android-studio
• Flutter plugin version 75.1.2
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.82.2)
• VS Code at /usr/share/code
• Flutter extension version 3.72.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 23.04 6.2.0-33-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.88
[✓] Network resources
• All expected network resources are available.
• No issues found!
And below is pubspec.yaml
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
flutter_launcher_icons: ^0.13.1
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/logo.png"
min_sdk_android: 21 # android min sdk min:16, default 21
remove_alpha_ios: true
web:
generate: true
background_color: "#hexcode"
theme_color: "#hexcode"
windows:
generate: true
icon_size: 48 # min:48, max:256, default: 48
macos:
generate: true
I have another project that was created before I upgraded flutter, and it's OK to run flutter_launcher_icons.
But once I clean the flutter cache, error occurs.
dart run flutter_launcher_icons # successfully, no error at all
flutter clean
flutter pub get
dart run flutter_launcher_icons # that error occurs
Same issue. Did you find any solution?
add or modify the image dependency: image: 4.0.17
add or modify the image dependency: image: 4.0.17
It works, Thank you.
I'm still encountering this error. I attempted to use the image
version 4.0.17, but the issue persists.
flutter_launcher_icons:
image_path: images/appicon.png
adaptive_icon_background: images/appicon-background.png
adaptive_icon_foreground: images/appicon-foreground.png
android: true
ios: true
remove_alpha_ios: true
@jerwin-fernandez, Thanks for reporting this! We had the same issue too and "fixed" it by hard coding image in pub spec in flutter (e.g., to "image: 4.1.0"). However, since we do not want to keep our project hard codded to "image: 4.1.0" forever and allow it to upgrade to newer versions, can you open this issue so that the "flutter_launcher_icons" team can find a maintainable fix? For example, a fix where "flutter_launcher_icons" is compatible with the latest image package. Thoughts?
@jerwin-fernandez, Thanks for reporting this! We had the same issue too and "fixed" it by hard coding image in pub spec in flutter (e.g., to "image: 4.1.0"). However, since we do not want to keep our project hard codded to "image: 4.1.0" forever and allow it to upgrade to newer versions, can you open this issue so that the "flutter_launcher_icons" team can find a maintainable fix? For example, a fix where "flutter_launcher_icons" is compatible with the latest image package. Thoughts?
reopening the issue.
still getting the error with the config from example
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "launcher/launcher.png"
min_sdk_android: 21
Built flutter_launcher_icons:flutter_launcher_icons.
════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.13.1)
════════════════════════════════════════════
• Creating default icons Android
• Adding a new Android launcher icon
✕ Could not generate launcher icons
RangeError (index): Index out of range: index should be less than 9216: 9224
upd: adding image 4.0.17 helps but still..
@khojiakbar17 Where did you add the image: 4.0.17? You have to add it to the flutter_launcher_icons package itself and run flutter clean
and flutter pub get
command.
bug in dependency: image, already fixed in latest version 4.1.3 no need to override image version again
https://github.com/brendan-duncan/image/issues/575#issuecomment-1734763849
bug in dependency: image, already fixed in latest version 4.1.3 no need to override image version again
remove the hard-coded dependency of image: 4.0.17 on pubspec.yaml
clean dependency flutter clean
install dependency flutter pub get
Resolving dependencies... collection 1.17.2 (1.18.0 available) image 4.0.17 (4.1.3 available) material_color_utilities 0.5.0 (0.8.0 available) meta 1.9.1 (1.10.0 available) petitparser 5.4.0 (6.0.1 available) stack_trace 1.11.0 (1.11.1 available) stream_channel 2.1.1 (2.1.2 available) test_api 0.6.0 (0.6.1 available) web 0.1.4-beta (0.2.1-beta available) xml 6.3.0 (6.4.2 available) Got dependencies!
upgrade image dependency flutter pub upgrade image
run flutter launcher icons flutter pub run flutter_launcher_icons
:information_source: Info
Version: ^0.13.1
:speech_balloon: Description
When running this command flutter pub run flutter_launcher_icons I am getting this error RangeError (index): Index out of range: index should be less than 9216: 9252
Deprecated. Use
dart run
instead. ════════════════════════════════════════════ FLUTTER LAUNCHER ICONS (v0.13.1) ════════════════════════════════════════════• Creating default icons Android • Adding a new Android launcher icon
✕ Could not generate launcher icons RangeError (index): Index out of range: index should be less than 9216: 9252
:scroll: Pubspec.yaml
flutter_launcher_icons: android: 'launcher_icon' ios: true image_path: 'images/icon/icon.png' min_sdk_android: 21 # android min sdk min:16, default 21