fluttercommunity / flutter_launcher_icons

Flutter Launcher Icons - A package which simplifies the task of updating your Flutter app's launcher icon. Fully flexible, allowing you to choose what platform you wish to update the launcher icon for and if you want, the option to keep your old launcher icon in case you want to revert back sometime in the future. Maintainer: @MarkOSullivan94

Home Page:https://pub.dev/packages/flutter_launcher_icons

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] NoConfigFoundException

sara010 opened this issue · comments

Unhandled exception:

✗ ERROR: NoConfigFoundException
No configuration found in flutter_launcher_icons.yaml or in pubspec.yaml. In case file exists in different directory use --file option
#0 createIconsFromArguments (package:flutter_launcher_icons/main.dart:82:7)
#1 main (file:///Users/kevinhhliu/.pub-cache/hosted/pub.flutter-io.cn/flutter_launcher_icons-0.11.0/bin/flutter_launcher_icons.dart:7:26)
#2 main (file:///Users/kevinhhliu/.pub-cache/hosted/pub.flutter-io.cn/flutter_launcher_icons-0.11.0/bin/main.dart:7:26)
#3 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:295:32)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

use the 0.11.0 version
i found that use
flutter_icons:
xxx
works!

this is because i view the source code 'flutter_launcher_icons_config.dart':
/// Loads flutter launcher icons config from pubspec.yaml file
static FlutterLauncherIconsConfig? loadConfigFromPubSpec(String prefix) {
try {
final pubspecFile = File(path.join(prefix, constants.pubspecFilePath));
if (!pubspecFile.existsSync()) {
return null;
}
final pubspecContent = pubspecFile.readAsStringSync();
return yaml.checkedYamlDecode<FlutterLauncherIconsConfig?>(
pubspecContent,
(json) {
// todo: add support for new scheme #373
return json == null || json['flutter_icons'] == null
? null
: FlutterLauncherIconsConfig.fromJson(json['flutter_icons']);
},
allowNull: true,
);
} on yaml.ParsedYamlException catch (e) {
throw InvalidConfigException(e.formattedMessage);
} catch (e) {
rethrow;
}
}
}

commented

I have the same issue, is it like an update issue because i used this package just last week with another flutter application and it wasnt thriwing this error

I also had this error. Please update the docs.

The lib Documentation is wrong, instead of:

flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21

You should use:

flutter_icons: <-- Just change this line.
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21 

Please upgrade to the latest version of the package.
We introduced this change in recent release d314ca8

This is still not fixed... @RatakondalaArun

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0
  flutter_launcher_icons: "^0.13.1"

flutter_icons: #I've tried both `flutter_icons:` and `flutter_launcher_icons:` as the config name...
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/app_logo.png"
  min_sdk_android: 21
Building package executable... (2.2s)
Built flutter_launcher_icons:flutter_launcher_icons.
  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.13.1)
  ════════════════════════════════════════════

Unhandled exception:

✗ ERROR: NoConfigFoundException
No configuration found in flutter_launcher_icons.yaml or in pubspec.yaml. In case file exists in different directory use --file option
#0      createIconsFromArguments (package:flutter_launcher_icons/main.dart:84:7)

I finally found a fix for this that worked for me as the others mentioned here on GitHub didn't work, basically what I did was restart my system then opened up Android Studio and then my project, I created a new file in the root directory and called it config.yaml and then pasted the configuration from the pub.dev page for flutter_launcher_icons,

then i ran

flutter pub get

and then ran

flutter pub run flutter_launcher_icons -f <your config file name here>

so for me it would be

flutter pub run flutter_launcher_icons -f config.yaml

running the package i was able to resolve the exception.

here is how my config.yaml file looked like

flutter_launcher_icons:
  android: "launcher_icon"
  ios: false
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21 # android min sdk min:16, default 21
  adaptive_icon_background: "assets/icon/icon_background.png"
  adaptive_icon_foreground: "assets/icon/icon_foreground.png"

also make sure that your config.yaml file is in the same directory as your pubspec.yaml file

Edit: for me this has worked 100% both my splash screen and launcher_icon have changed successfully