flutter_launcher_icons icon indicating copy to clipboard operation
flutter_launcher_icons copied to clipboard

Could not find package "flutter_launcher_icons"

Open liloSc opened this issue 4 years ago • 15 comments

I did all the steps mentioned..

But when I run the command flutter pub run flutter_launcher_icons:main

I just get this Error Message: Could not find package "flutter_launcher_icons". Did you forget to add a dependency? pub finished with exit code 65

But I added this to the pubspeck.yaml file. As you can see here:

pubspeck.yaml

liloSc avatar Jan 08 '20 13:01 liloSc

Can u try to indent the flutter_icons and its children to the right?

ride4sun avatar May 05 '20 19:05 ride4sun

I got the same problem when using: flutter_launcher_icons.yaml

dev_dependencies:
  flutter_launcher_icons: "^0.7.5"

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon/icon.png"
flutter pub run flutter_launcher_icons:main

Error: Could not find package "flutter_launcher_icons". Did you forget to add a dependency? pub finished with exit code 65

jorwan avatar May 08 '20 10:05 jorwan

This suggests the package hasn't successfully been downloaded. Do you run flutter pub get to download flutter_launcher_icons after you'd added it to your pubspec.yaml?

timsneath avatar May 10 '20 01:05 timsneath

i am having same problem and run flutter pub get also but still it is showing error Could not find package "flutter_launcher_icons". Did you forget to add a dependency?

kirtib121 avatar Jul 29 '20 03:07 kirtib121

Just to help the next guy...

I was receiving the same error. At the time I was using a separate flutter_launcher_icons.yaml file like this:

// flutter_launcher_icons.yaml

dev_dependencies:
  flutter_launcher_icons: "^0.8.1"

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/logo/diamond.png"

But after moving the above statements to pubspec.yaml and deleting the flutter_launcher_icons.yaml file, the error got resolved.

Megidd avatar Oct 28 '20 05:10 Megidd

Yes I can also confirm that by using separate file in does NOT work, but by including into pubspec.yaml it does work.

ajitam avatar Nov 06 '20 07:11 ajitam

is this still not fixed ?

Ahmedibrahim66 avatar Nov 20 '20 16:11 Ahmedibrahim66

I had this problem in Android Studio but it worked fine when I ran it in the vsCode terminal, no idea why but it might help someone else ?

MaxWroe avatar Dec 14 '20 00:12 MaxWroe

Make sure you're in the right directory. I'm betting most people are dopes like me, and this is the issue.

jbryanh avatar Dec 23 '20 17:12 jbryanh

I am facing same issue but finally got solutions. I have added my flutter_luncher_icons in another sdk dependencies . See my pubspec.yaml file .

name: NewsApi.org
description: A new Flutter application.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  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.1
  fluttertoast: ^7.1.6
  toast: ^0.1.5
  flutter_launcher_icons: ^0.8.0




dev_dependencies:
  flutter_test:
    sdk: flutter

flutter_icons:
  image_path: "assets/icon/newsicon.png"
  android: true
  ios: false

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  assets:
    - assets/images/dropbox.png



  fonts:
    - family: LangerReguler
      fonts:
        - asset: assets/langer_reguler.ttf




  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

** And then Run flutter pub get and flutter_luncher_icon** commands in command prompt. This is what I get the result after the successfully run the command . And luncher icon is also generated.

_```

[E:\AndroidStudioProjects\FlutterProject\NewsFlutter\news_flutter>flutter pub get
Running "flutter pub get" in news_flutter...                       881ms

E:\AndroidStudioProjects\FlutterProject\NewsFlutter\news_flutter>flutter pub run flutter_launcher_icons:main
  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.8.0)
  ════════════════════════════════════════════

• Creating default icons Android
• Overwriting the default Android launcher icon with a new icon

✓ Successfully generated launcher icons

Hope this will certainly help you.

rahulkushwaha482 avatar Dec 31 '20 09:12 rahulkushwaha482

I was facing the same issue, but in my case I resolved it by saving the pubspec.yaml file on vscode

Giaochan avatar Apr 05 '21 05:04 Giaochan

Just, Run Flutter Clean, Flutter pub get then command for changing launcher icon. It solves my problem.

MuhammadSufyanMalik avatar May 23 '21 16:05 MuhammadSufyanMalik

I did all the steps mentioned..

But when I run the command flutter pub run flutter_launcher_icons:main

I just get this Error Message: Could not find package "flutter_launcher_icons". Did you forget to add a dependency? pub finished with exit code 65

But I added this to the pubspeck.yaml file. As you can see here:

pubspeck.yaml

Use

flutter_launcher_icons:

without specific version

santroDev avatar Jul 16 '21 02:07 santroDev

I am just a beginner in flutter and I had the same issue while using flutter pub run flutter_launcher_icons:main Command I overcome it by adding a proper flutter_launcher_icons version... In my case needed version was flutter_launcher_icons: ^0.9.0 and it wasn't mentioned before. So when I add this in devDependencies like :

dev_dependencies: flutter_driver: sdk: flutter test: ^1.16.5 dependency_validator: 3.1.0 encrypt: ^5.0.0 flutter_launcher_icons: ^0.9.0

Enable To run json serializer, run: flutter pub run build_runner build --build-filter="lib/models/serializers/.dart" --delete-conflicting-outputs flutter pub run build_runner serve --build-filter="lib/models/serializers/.dart" build_runner: 2.0.3 json_serializable: 4.1.2

Run this script to generate the app icon: flutter pub run flutter_launcher_icons:main

flutter_icons: android: "launcher_icon" ios: true image_path: "assets/images/app_icon.png"

It Worked for me!!!!

amitw7786 avatar Sep 15 '21 18:09 amitw7786

i was having the issue.

then i did the followings:

  1. added flutter_launcher_icons: "^0.9.2"
  2. run pub get
  3. added flutter_icons: android: "launcher_icon" ios: true image_path: "assets/images/icon.png"
  4. run pub get
  5. save the file
  6. run this: flutter pub get flutter pub run flutter_launcher_icons:main

and it worked. nobody can explain why. but it works.

smile675 avatar Feb 23 '22 13:02 smile675

Don't add dependanies to pubspec by hand, just use terminal command: "flutter pub add flutter_launcher_icons"

Some reason that works.

ichhh avatar Nov 09 '22 23:11 ichhh

I have the same problem and solved by add 'flutter_launcher_icons: "^0.13.1"' under dev_dependencies: in pubspec.yaml

stephensir avatar May 05 '23 02:05 stephensir

Don't add dependanies to pubspec by hand, just use terminal command: "flutter pub add flutter_launcher_icons"

Some reason that works.

dragos@Dragoss-MacBook-Pro ios % flutter pub add flutter_launcher_icons Resolving dependencies...

  • archive 3.3.7
  • args 2.4.2
  • checked_yaml 2.0.3
  • cli_util 0.4.0 collection 1.17.1 (1.17.2 available)
  • convert 3.1.1
  • crypto 3.0.3
  • flutter_launcher_icons 0.13.1
  • image 4.0.17
  • json_annotation 4.8.1 matcher 0.12.15 (0.12.16 available) material_color_utilities 0.2.0 (0.5.0 available)
  • petitparser 5.4.0
  • pointycastle 3.7.3 source_span 1.9.1 (1.10.0 available) test_api 0.5.1 (0.6.0 available)
  • typed_data 1.3.2
  • xml 6.3.0
  • yaml 3.1.2 Changed 14 dependencies! dragos@Dragoss-MacBook-Pro ios %

worked for me :) thanks

drag0s22 avatar Jun 08 '23 20:06 drag0s22

Just to help the next guy...

I was receiving the same error. At the time I was using a separate flutter_launcher_icons.yaml file like this:

// flutter_launcher_icons.yaml

dev_dependencies:
  flutter_launcher_icons: "^0.8.1"

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/logo/diamond.png"

But after moving the above statements to pubspec.yaml and deleting the flutter_launcher_icons.yaml file, the error got resolved.

it work for me the same way, deleted flutter_launcher_icon,yaml and added the following code to pubspec.yaml

dev_dependencies: flutter_launcher_icons: "^0.13.1"

flutter_launcher_icons: android: "launcher_icon" ios: true image_path: "assets/icon/icon.png" min_sdk_android: 21 # android min sdk min:16, default 21 web: generate: true image_path: "/wherever/your/file/is.png" background_color: "#hexcode" theme_color: "#hexcode"

than in terminal : dragos@Dragoss-MacBook-Pro ios % flutter pub get
Resolving dependencies... collection 1.17.1 (1.17.2 available) material_color_utilities 0.2.0 (0.5.0 available) source_span 1.9.1 (1.10.0 available) Got dependencies! dragos@Dragoss-MacBook-Pro ios % Deprecated. Use dart run instead. Building package executable... (2.8s) Built flutter_launcher_icons:flutter_launcher_icons. ════════════════════════════════════════════ FLUTTER LAUNCHER ICONS (v0.13.1)
════════════════════════════════════════════

• Creating default icons Android • Adding a new Android launcher icon

WARNING: Icons with alpha channel are not allowed in the Apple App Store. Set "remove_alpha_ios: true" to remove it.

• Overwriting default iOS launcher icon with new icon Creating Icons for Web... done

✓ Successfully generated launcher icons dragos@Dragoss-MacBook-Pro ios % flutter pub get
Resolving dependencies... collection 1.17.1 (1.17.2 available) material_color_utilities 0.2.0 (0.5.0 available) source_span 1.9.1 (1.10.0 available) Got dependencies! dragos@Dragoss-MacBook-Pro ios % flutter pub run flutter_launcher_icons Deprecated. Use dart run instead. Building package executable... (2.8s) Built flutter_launcher_icons:flutter_launcher_icons. ════════════════════════════════════════════ FLUTTER LAUNCHER ICONS (v0.13.1)
════════════════════════════════════════════

• Creating default icons Android • Adding a new Android launcher icon

WARNING: Icons with alpha channel are not allowed in the Apple App Store. Set "remove_alpha_ios: true" to remove it.

• Overwriting default iOS launcher icon with new icon Creating Icons for Web... done

✓ Successfully generated launcher icons dragos@Dragoss-MacBook-Pro ios %

https://github.com/fluttercommunity/flutter_launcher_icons/assets/135709379/89999f7a-a729-4ea0-b6bb-f193a6769c48

drag0s22 avatar Jun 08 '23 22:06 drag0s22

sorry, by mistake without preview . apparently i cannot edit my previous post.

drag0s22 avatar Jun 08 '23 22:06 drag0s22

/Answer for all: Separating the dependencies and place the version dependency code above all variables dependency code.

Example: If you have other dependencies separate your variables dependency from all your versions dependency code.

The reason adding it to dev_dependencies worked is because there is no conflict and it is to the top.

dependencies:
  flutter:
    sdk: flutter

//VERSION DEPENDENCIES TO TOP
  flutter_launcher_icons: ^0.13.1
  flutter_native_splash: ^2.3.2
  flutter_riverpod: ^2.3.6
  


//ALL VARIABLES DEPENDENCIES TO BOTTOM
flutter_launcher_icons:
  color: "#FFFFFF"
  android: "launcher_icon"
  ios: false 
  image_path: "assets/logo.png"
  min_sdk_android: 21

flutter_native_splash:
  color: "#ffffff"
  image: "assets/launch_image.png"

For troubleshooting, check if dependency is connected by changing to a previous version and run flutter pub outdated.

If flutter_launcher_icons shows up then below code should work.

flutter pub run flutter_launcher_icons or dart run flutter_launcher_icons.

EthikalHaKingGhost avatar Aug 14 '23 05:08 EthikalHaKingGhost