Home > Mobile >  ✓ Successfully generated launcher icons , Unhandled exception: FileSystemException: Cannot open file
✓ Successfully generated launcher icons , Unhandled exception: FileSystemException: Cannot open file

Time:03-20

I am getting this error when I am trying to change the app icon with the "flutter_launcher_icons 0.9.2". I tried specifing the app minsdk and targetsdk but that did not work.I have done flutter pub get several times. After that when I do:flutter pub run flutter_launcher_icons:main. I get this error

This is my pubspec.yaml:

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.9.2

flutter_icons:
  android: true
  ios: true
  image_path: "dev_assets/news-logos.jpeg"
  adaptive_icon_background: "#FFFFFF"
  adaptive_icon_foreground: "dev_assets/news-logos.jpeg"

my android/app/build.gradle:

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.news_app"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

Full error:

✓ Successfully generated launcher icons
Unhandled exception:
FileSystemException: Cannot open file, path = 'dev_assets/news-logos.jpeg' (OS Error: The system cannot find the path specified.
, errno = 3)
#0      _File.throwIfError (dart:io/file_impl.dart:635:7)
#1      _File.openSync (dart:io/file_impl.dart:479:5)
#2      _File.readAsBytesSync (dart:io/file_impl.dart:539:18)
#3      decodeImageFile (package:flutter_launcher_icons/utils.dart:35:44)
#4      createDefaultIcons (package:flutter_launcher_icons/android.dart:35:24)
#5      createIconsFromConfig (package:flutter_launcher_icons/main.dart:103:28)
#6      createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7)
#7      main (file:///D:/flutter_windows_2.5.1-stable/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/bin/main.dart:6:26)
#8      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
pub finished with exit code 255

Folders

CodePudding user response:

Read the error, your path to the file is not correct.

CodePudding user response:

This seems like a windows error. I have few solutions

  1. Right click on news-logos.jpeg and copy relative path then paste in anywhere that needs it.

  2. Change dev_assets/news-logos.jpeg to dev_assets\news-logos.jpeg as windows doesn't use /

  • Related