Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unhandled exception: FormatException: Invalid number (at character 1) ^ #0 int._handleFormatError (dart:core-patch/integers_patch.dart:129:7) #1 int.parse (dart:core-patch/integers_patch.dart:55:14) #2 minSdk (package:flutter_launcher_icons/android.dart:309:18) #3 createIconsFromConfig (package:flutter_launcher_icons/main.dart:94:47) #4 createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7) #5 main (file:///C:/Users/Heba/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/bin/main.dart:6:26) #6 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32) #7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) pub finished with exit code 255[BUG] #359

Closed
hebaea opened this issue Apr 19, 2022 · 18 comments · Fixed by #322

Comments

@hebaea
Copy link

hebaea commented Apr 19, 2022

ℹ️ Info

Version: e.g. v0.7.5

💬 Description

Enter a description of your problem here

📜 Pubspec.yaml

We ask that you include your pubspec.yaml file as a common problem we have seen has been the pubspec.yaml file being incorrect

@prgtrdr
Copy link

prgtrdr commented Apr 19, 2022

Same problem. Here's my pubspec.yaml.

name: bestest
description: A new Flutter project.

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

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.16.2 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  animated_text_kit: ^4.2.1
  cupertino_icons: ^1.0.2
  firebase_auth: ^3.3.14
  firebase_core: ^1.14.1
  flutter:
    sdk: flutter

  flutterfire_ui: ^0.4.0+2
  settings_ui: ^2.0.2

dev_dependencies:
  flutter_lints: ^1.0.0
  flutter_test:
    sdk: flutter
  flutter_launcher_icons: ^0.9.2

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/logo.png" 
 
  # optionally, as transparency is not allowed on app store
  # remove_alpha_ios: true  
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# 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

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/images/logo.png
  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.
  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages
  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # 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

@levi956
Copy link

levi956 commented Apr 19, 2022

Same problem

@codegrue
Copy link

codegrue commented Apr 20, 2022

I get the same problem. Here is my config:

flutter_icons:
  android: true
  ios: true
  image_path: "assets/images/app_icon.png"
  adaptive_icon_background: "assets/images/app_icon_android_background.png"
  adaptive_icon_foreground: "assets/images/app_icon_android_foreground.png"

If I comment out the adaptive items, it works.

My error is slightly different:

  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.9.1)
  ════════════════════════════════════════════

✓ Successfully generated launcher icons
Unhandled exception:
FormatException: Invalid number (at character 1)
^
#0      int._handleFormatError (dart:core-patch/integers_patch.dart:129:7)
#1      int.parse (dart:core-patch/integers_patch.dart:55:14)
#2      minSdk (package:flutter_launcher_icons/android.dart:309:18)
#3      createIconsFromConfig (package:flutter_launcher_icons/main.dart:94:47)
#4      createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7)
#5      main (file:///C:/Users/jeff/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/bin/main.dart:6:26)
#6      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
pub finished with exit code 255

@vensauro
Copy link

Same here
image

on Dart SDK version 2.16.2 and Flutter 2.10.4

@vensauro
Copy link

I see that the code tries to read the file build.gradle on this line:
image
and not have numbers on this line

@vensauro
Copy link

the flutter changed the way to set the minSdkVersion
https://stackoverflow.com/questions/70341325/how-do-i-update-minsdkversion-and-targetsdkversion-in-the-new-version-of-flutter
https://stackoverflow.com/questions/70311685/how-to-update-minsdkversion-in-flutter-updated-2-8

after editing the file, all works fine
image

this can be a workaround yet the package not update

@mohadel92
Copy link

same problem

@mohadel92
Copy link

@vensauro this was the fix thanks

@cotwitch
Copy link

https://pub.dev/packages/flutter_launcher_icons_maker

@vensauro
Copy link

https://pub.dev/packages/flutter_launcher_icons_maker

this is a nice alternative, I think that this repo needs more maintainers, the actual maintainer can not have more time to work here (and that's is ok)

@jlyonsmith
Copy link

jlyonsmith commented Apr 30, 2022

You can also use one of the many fixed forked versions to get around the problem. For example:

dev_dependencies:
  flutter_launcher_icons:
    git:
      url: git@github.com:RatakondalaArun/flutter_launcher_icons.git
      ref: fix/flutter-v2.8.0-support-321

This checks the local.properties file for a definition of minSdkVersion which you should set to 26 or higher to support Android adaptive icons. I don't recommend changing the version number directly in the build.gradle file as it just makes the project harder to upgrade in the future.

Anyone else super frustrated by the number of abandoned repos on Github? It's absolutely not the maintainers fault. I see it as a failing of Github & the package hosting sites (NPM, Pub.dev, RubyGems, etc..) to provide a mechanism for the community to take over maintenance of important repo's that are no longer supported.

@Veseth2021
Copy link

Should use this forked package instead: https://pub.dev/packages/icons_launcher

@draskosaric
Copy link

Just add in android/app/build.gradle

minSdkVersion 21

instead of

minSdkVersion flutter.minSdkVersion

@priyaranjan-mantri
Copy link

priyaranjan-mantri commented May 9, 2022

defaultConfig {

    minSdkVersion 21
    targetSdkVersion flutter.targetSdkVersion

}

change minSdkVersion to 21 ,

after this it will work

@jlyonsmith
Copy link

@priyaranjan-mantri and @draskosaric Your solution is correct, making those changes will workaround the problem. However, new Flutter projects will not use a hard coded number for minSdkVersion so you will constantly have to make this patch if you create new projects or upgrade existing ones. For that reason, I recommend creating a local.properties file and using the maintained icons_launcher tool instead.

@draskosaric
Copy link

Yes, you are right. This is a quick workaround. And this plugin unfortunately is not the only one that needs this kind of hack.

@tango4567
Copy link

Same Problem I'm also facing while running flutter_launcher_icons:main -f pubspec.yaml
even though I followed @vensauro solutions also.

  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.9.1)
  ════════════════════════════════════════════


 Successfully generated launcher icons
Unhandled exception:
FormatException: Invalid number (at character 1)

^

#0      int._handleFormatError (dart:core-patch/integers_patch.dart:129:7)
#1      int.parse (dart:core-patch/integers_patch.dart:55:14)
#2      minSdk (package:flutter_launcher_icons/android.dart:309:18)
#3      createIconsFromConfig (package:flutter_launcher_icons/main.dart:94:47)
#4      createIconsFromArguments (package:flutter_launcher_icons/main.dart:60:7)
#5      main (file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/bin/main.dart:6:26)
#6      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

@samirreaz
Copy link

problem is solved..
just change:
minSdkVersion 21

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.