flutter_launcher_icons icon indicating copy to clipboard operation
flutter_launcher_icons copied to clipboard

[BUG]

Open Psycarlo opened this issue 5 years ago • 13 comments

Version: v^0.8.0

:speech_balloon: Description

Can't run flutter pub run flutter_launcher_icons:main . I have 3 different flavors yaml files. For example this flutter_launcher_icons-dev.yaml : flutter_icons: android: true ios: true image_path: "assets/launcher_icon/<image-name>.png"

The error when I run that command: ✗ ERROR: NoConfigFoundException Check that your config file flutter_launcher_icons.yaml has a flutter_icons section

When I run flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-dev.yaml :

`FileSystemException: Cannot open file, path = 'flutter_launcher_icons-dev.yaml' (OS Error: The system cannot find the file specified. , errno = 2)

✓ Successfully generated launcher icons Unhandled exception: NoSuchMethodError: The method 'containsKey' was called on null. Receiver: null Tried calling: containsKey("image_path")` ...

:scroll: Pubspec.yaml

`name: description: A new Flutter project.

publish_to: "none"

version: 1.0.0+1

environment: sdk: ">=2.7.0 <3.0.0"

dependencies: flutter: sdk: flutter

flutter_launcher_icons: ^0.8.0

cupertino_icons: ^0.1.3

dev_dependencies: flutter_test: sdk: flutter

flutter: uses-material-design: true`

Psycarlo avatar Sep 28 '20 20:09 Psycarlo

Try importing your images first on your pubspec.yaml:

flutter:
  assets:
    - assets/launcher_icon/<image-name>.png

(PS: don't forget to create an assets directory before inserting the code.)

Then, insert this below flutter so you don't have to create another YAML file.

flutter_icons:
  android: true
  ios: true
  image_path: "assets/<image-name>.png"

msyagami avatar Sep 29 '20 01:09 msyagami

The problem with flutter_icons: android: true ios: true image_path: "assets/<image-name>.png"

is that I have 3 different flavors. I want to run flutter run --flavor {flavor} and different app icon appear. Following the example here: https://github.com/fluttercommunity/flutter_launcher_icons/tree/master/example/flavors

but this error keeps showing:

✗ ERROR: NoConfigFoundException Check that your config file flutter_launcher_icons.yamlhas aflutter_icons section pub finished with exit code 1

Psycarlo avatar Sep 29 '20 11:09 Psycarlo

Under lib/main.dart on the flavorConfigFilePattern String I only get a match on my flutter_launcher_icons-<>.yaml files if I change it to: '\.\\\\flutter_launcher_icons-(.*).yaml' instead of '\./flutter_launcher_icons-(.*).yaml'. (I'm on Windows).

However, in the fork, I can run...

Can someone verify this?

Psycarlo avatar Sep 30 '20 21:09 Psycarlo

I just copied the flutter_launcher_icons-<>.yaml from the fork and paste on my project and they worked for a single file: -f option

However, there are 3 envs that I have. So when the code runs getFlavors() and none of my files match, flavors List will be empty and hasFlavors will be false.

vs

Note: We dart in need to escape both \ so it would be \\\\

Psycarlo avatar Sep 30 '20 22:09 Psycarlo

The error ✗ ERROR: NoConfigFoundException Check that your config file flutter_launcher_icons.yamlhas aflutter_icons section pub finished with exit code 1 is being made by this function: loadConfigFileFromArgResults(argResults, verbose: true) > loadConfigFile(String path, String fileOptionResult) when running: flutter run pub flutter_launcher_icons:main when having multiple flavors.

With the previous fix, running: flutter run pub flutter_launcher_icons:main -f <file_of_choice.yaml> this runs all envs.

Psycarlo avatar Sep 30 '20 23:09 Psycarlo

I confirm. I have the same issues. Flavor support needs to be documented more. I have my 3 flavor-specific YAML files, now which commands should I run to create icons for each flavor? Ideally a single command should create icons for all flavors at once.

sarbogast avatar Oct 04 '20 12:10 sarbogast

I might have fixed this in #155... Would someone be willing to confirm this?

flutter run pub flutter_launcher_icons:main should run for all flavors. Can't confirm. Still not working for me.

Psycarlo avatar Nov 07 '20 18:11 Psycarlo

Did you fix it?

jamiul-999 avatar May 22 '21 08:05 jamiul-999

Ideally a single command should create icons for all flavors at once.

@sarbogast this actually already happens with the original flavors feature implementation, if you specify a config file then it'll automatically look for any other config files you have and run them too

You can try this out in the example project: https://github.com/fluttercommunity/flutter_launcher_icons/tree/master/example/flavors

Instead of running

flutter run pub flutter_launcher_icons:main

You should run

flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-production.yaml

MarkOSullivan94 avatar Jul 25 '21 20:07 MarkOSullivan94

flutter run pub flutter_launcher_icons:main should run for all flavors. Can't confirm. Still not working for me.

I'm not sure I understand @Psycarlo, sorry!

Do you have flavors enabled in your project and you want to edit your pubspec.yaml file with Flutter Launcher Icons and have it change the icon for all flavors?

MarkOSullivan94 avatar Jul 25 '21 20:07 MarkOSullivan94

Also @Psycarlo I'm afraid I don't understand the issue here, would you be able to fork Flutter Launcher Icons and setup the example project so it replicates the issue you're having?

Once you do that I can clone it and run the example to debug what's going wrong

MarkOSullivan94 avatar Jul 25 '21 20:07 MarkOSullivan94

flutter pub run flutter_launcher_icons:main instead of flutter run pub flutter_launcher_icons:main

EduardoMoreira26 avatar Jul 08 '22 20:07 EduardoMoreira26