admin管理员组

文章数量:1287838

i just started this week again with dart/flutter and wanted to change my launcher icons, i tried allot of tutorials but i keep getting the following error`s.

This is my pubspec.yaml

dependencies:

  water_drop_nav_bar:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.8
  flutter_launcher_icons: ^0.14.3


dev_dependencies:
  flutter_test:
    sdk: flutter
flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21
  web:
    generate: true
    image_path: "assets/icon/icon.png"
    background_color: "#FFFFFF" # White background
    theme_color: "#007BFF" # Blue theme color
  windows:
    generate: true
    image_path: "assets/icon/icon.png"
    icon_size: 48
  macos:
    generate: true
    image_path: "assets/icon/icon.png"

and i will get the following error,

• Overwriting default iOS launcher icon with new icon
Creating Icons for Web...
⚠️PathNotFoundException: Cannot open file, path = '.\path/to/image.png' (OS Error: The system cannot find the path specified.
, errno = 3)
Creating Icons for Windows...
⚠️.\path/to/image.png this file or folder is required to generate web icons
⚠️Requirements failed for platform Windows. Skipped
Creating Icons for MacOS...
⚠️PathNotFoundException: Cannot open file, path = '.\path/to/image.png' (OS Error: The system cannot find the path specified.
, errno = 3)

i tried:

flutter pub clean flutter pub get flutter pub run flutter_launcher_icons

but i still will get the errors

sorry for my probably simple error i just want to learn and improve myself

i just started this week again with dart/flutter and wanted to change my launcher icons, i tried allot of tutorials but i keep getting the following error`s.

This is my pubspec.yaml

dependencies:

  water_drop_nav_bar:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.8
  flutter_launcher_icons: ^0.14.3


dev_dependencies:
  flutter_test:
    sdk: flutter
flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
  min_sdk_android: 21
  web:
    generate: true
    image_path: "assets/icon/icon.png"
    background_color: "#FFFFFF" # White background
    theme_color: "#007BFF" # Blue theme color
  windows:
    generate: true
    image_path: "assets/icon/icon.png"
    icon_size: 48
  macos:
    generate: true
    image_path: "assets/icon/icon.png"

and i will get the following error,

• Overwriting default iOS launcher icon with new icon
Creating Icons for Web...
⚠️PathNotFoundException: Cannot open file, path = '.\path/to/image.png' (OS Error: The system cannot find the path specified.
, errno = 3)
Creating Icons for Windows...
⚠️.\path/to/image.png this file or folder is required to generate web icons
⚠️Requirements failed for platform Windows. Skipped
Creating Icons for MacOS...
⚠️PathNotFoundException: Cannot open file, path = '.\path/to/image.png' (OS Error: The system cannot find the path specified.
, errno = 3)

i tried:

flutter pub clean flutter pub get flutter pub run flutter_launcher_icons

but i still will get the errors

sorry for my probably simple error i just want to learn and improve myself

Share Improve this question asked Feb 22 at 22:55 zeroxzerox 53 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

I had this problem with flutter_launcher_icons package

You can change the icon of the app from the flutter project files

1.For Android

  1. Go to any android icons generator , I use this android_icon_generator
  2. Upload the you icon and download the .zip file
  3. Unzip the file you will find the android file
  4. select all item in this file and copy them
  5. Go to your Flutter project then to android/app/src/main/res/
  6. Replace all the files in this file by pasting them
  7. run you flutter app you will find the icon changed on the android app

2. For Windows

  1. Go to any windows icons generator , I use this windows_icon_generator
  2. Upload the you icon and download the .ico file
  3. Go to your Flutter project then to windows/runner/resources/
  4. You will find the default flutter icon
  5. Delete it and past you icon .ico
  6. It very important to rename the new icon with app_icon
  7. run you flutter app you will find the icon changed on the windows app

3. For IOS:

  1. Go to any IOS icon generator, I use this with ios option: ios_icon_generator
  2. Upload the you icon and download the .zip file
  3. Unzip the file you will find the AppIcon.appiconset file
  4. select all item in this file and copy them
  5. Go to the ios/Runner/Assets.xcassets/AppIcon.appiconset directory in your Flutter project.
  6. Replace all the files in this file by pasting them
  7. Open the Contents.json file in the AppIcon.appiconset folder.
  8. Normally the generator update Contents.json ,but in case,
  9. Ensure the filename fields in the JSON file match the names of your new icons.

4. For macOS:

  1. Go to any macos icon generator, I use this with macos option: macos_icon_generator
  2. Upload the you icon and download the .zip file
  3. Unzip the file you will find the AppIcon.appiconset file
  4. Select all item in this file and copy them
  5. Go to the macos/Runner/Assets.xcassets/AppIcon.appiconset directory in your Flutter project.
  6. Replace all the files in this file by pasting them
  7. Open the Contents.json file in the AppIcon.appiconset folder.
  8. Normally the generator update Contents.json ,but in case,
  9. Ensure the filename fields in the JSON file match the names of your new icons.

On ios && macos the Contents.json should look like this :

idoim is iphone for ios and mac for macos

{
    "images": [
        {
            "size": "60x60",
            "expected-size": "180",
            "filename": "180.png",
            "folder": "Assets.xcassets/AppIcon.appiconset/",
            "idiom": "iphone",
            "scale": "3x"
        },
        {
            "size": "40x40",
            "expected-size": "80",
            "filename": "80.png",
            "folder": "Assets.xcassets/AppIcon.appiconset/",
            "idiom": "iphone",
            "scale": "2x"
        },
        .....
    ]
}

5. For Web:

  1. Go to this website to generate the web icons :web_icon_generator
  2. Upload your .png image press Create Favicon and download the .zip file
  3. Unzip the file you will find the manifest.json file and you icons with diffrent sizes copy them
  4. Go to the web/icons directory in your Flutter project
  5. Replace the icons of icons file with the generated icons
  6. Replace the manifest.json file also and the favicon but do not touch the index.html file.
  7. Open the web/index.html file in your flutter project.
  8. Add this code which generated by the favicon
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192"  href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
  1. Sometimes the generator do not create the manifest.json complete so please ensure that every thing is complete
{
    "name": "APP_NAME",
    "short_name": "APP_NAME",
    "start_url": ".",
    "display": "standalone",
    "background_color": "#0175C2",
    "theme_color": "#0175C2",
    "description": "A new Flutter project.",
    "orientation": "portrait-primary",  
    "prefer_related_applications": false,
    "icons": [
        {
            "src": "\/icons/android-icon-36x36.png",
            "sizes": "36x36",
            "type": "image\/png",
            "density": "0.75"
        },
        {
            "src": "\/icons/android-icon-48x48.png",
            "sizes": "48x48",
            "type": "image\/png",
            "density": "1.0"
        },
        {
            "src": "\/icons/android-icon-72x72.png",
            "sizes": "72x72",
            "type": "image\/png",
            "density": "1.5"
        },
        {
            "src": "\/icons/android-icon-96x96.png",
            "sizes": "96x96",
            "type": "image\/png",
            "density": "2.0"
        },
        {
            "src": "\/icons/android-icon-144x144.png",
            "sizes": "144x144",
            "type": "image\/png",
            "density": "3.0"
        },
        {
            "src": "\/icons/android-icon-192x192.png",
            "sizes": "192x192",
            "type": "image\/png",
            "density": "4.0"
        }
    ]
}

After every thing run these commands :

flutter clean
flutter pub get

And when you build any release of theme android, windows, ios, macos or web the icon should be changed

Hope that was helpful for you !!

本文标签: dartFlutter launcher wont runStack Overflow