'flutter_launcher_icons not working Unhandled exception: FormatException: Invalid number (at character 1)
I want to change my app icon in flutter using flutter_launcher_icons: ^0.9.2 
It shows me errors while I'm running Command flutter pub run flutter_launcher_icons:main 
Image of the error
I tried many times but no new results
Solution 1:[1]
I just had the same problem and solved doing this in android/app/build.gradle.
Changed:
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
To:
minSdkVersion 26
targetSdkVersion 30
[Edit] After that, I could not run on emulator, so I changed back the gradle file (without running flutter_launcher_icon again). Now I have the app running and the icons are right.
Solution 2:[2]
If the solution proposed by @Iagows doesn't work for you, have a look at this: flutter_launcher_icons-issues
Solution 3:[3]
Thanks to this answer, I was able to fix the issue!
Solution 4:[4]
Inside file: ~/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.2/lib/android.dart
Replace Line:
 final String minSdk = line.replaceAll(RegExp(r'[^\d]'), '');
 To this:
 final String minSdk = "21"; // line.replaceAll(RegExp(r'[^\d]'), '');
Save the file and then run:
    flutter pub get
    flutter pub run flutter_launcher_icons:main
Source : https://github.com/fluttercommunity/flutter_launcher_icons/issues/324
Solution 5:[5]
The issue is explained in the readme of the plugin, section "Dependency incompatible". It says
Because flutter_launcher_icons >=0.9.0 depends on args 2.0.0 and flutter_native_splash 1.2.0 depends on args ^2.1.1, flutter_launcher_icons >=0.9.0 is incompatible with flutter_native_splash 1.2.0.
And because no versions of flutter_native_splash match >1.2.0 <2.0.0, flutter_launcher_icons >=0.9.0 is incompatible with flutter_native_splash ^1.2.0.
So, because enstack depends on both flutter_native_splash ^1.2.0 and flutter_launcher_icons ^0.9.0, version solving failed.
pub get failed
The solution is given in as cryptic a manner as the description above, but the simple hack given by @deffo worked for me. https://github.com/fluttercommunity/flutter_launcher_icons/issues/324#issuecomment-1013611137
What you do is that you skip the version solving done when the plugin reads build.gradle and you force minSdkVersion to be whatever version you prefer.
It's a hack but since you generate automatically the app icons only once and for all, who cares? :-)
BTW, the following solution seems cleaner but I didn't test it: https://github.com/fluttercommunity/flutter_launcher_icons/issues/262#issuecomment-877653847
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | |
| Solution 2 | Deffo | 
| Solution 3 | Oli | 
| Solution 4 | chitreshpratapsingh | 
| Solution 5 | Khang Vu Tien | 
