flutter_launcher_icons not working Unhandled exception: FormatException: Invalid number (at character 1) - flutter-dependencies

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

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
Source
[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.

Thanks to this answer, I was able to fix the issue!

If the solution proposed by #Iagows doesn't work for you, have a look at this:
flutter_launcher_icons-issues

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

I just changed the package version in pubspec.yaml and that solved the problem for me.
dependencies:
flutter_launcher_icons: ^0.10.0

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

Related

react native problem with creating apk: gradle mergeDexRelease

My app works well on react-native-run-android and on gradlew clean provide me build success.
I used to check and creating the apk by using gradlew assembleRelease.
Recently, I faced an error while trying to create the APK and I cant find the right solution.
as far as I understand, some problem with the build.gradle or any gradle settings - the last feature I put was the mauron background geolocation (im not sure if that cause the problem).
I tried:
on gradle.properties :
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4608m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
in build.gradle I added: implementation 'androidx.multidex:multidex:2.0.1' in the dependencies.
3.
defaultConfig {
...
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
// multiDexEnabled true
}
The gradle I used was 6.3. So I upgraded (downloaded from their website v7 but I think the project is still under 6.3).
My question is:
If the app works and build successfuly, was the error because of my code or the gradle settings?
Im over a week with that problem and out of any clue how to get it work.
the error I get:
> Task :app:mergeDexRelease FAILED
D8: Program type already present: org.apache.commons.io.Charsets
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: org.apache.commons.io.Charsets
full picture: https://ibb.co/87pFnv1 , https://ibb.co/FxB8PWX
could anyone help me with it?
The error is not about multidex. It clearly says that one of your package is trying to add a library which is already there.
Since you have the name of the library you can put conditional implementation in your build.gradle to avoid redundant implementation.
for example
Implementation('new package that has module'){
exclude module: 'module to exclude'
}
Finally I solved the problem, Thanks Shashank Shekhar for directing me to the correct problem.
I used mauron85/react-native-background-geolocation package, was working fine until I tried to create apk.
in mauron85 issue #505 there was similar problem and someone fixed it by forking and maintaining the repo.
if anyone face that issue in future, I recommend to use #darron1217/react-native-background-geolocation as it solved the error.
Resolved: I have two packages #react-native-masked-view/masked-view (from previous developer) and #react-native-community/masked-view. Just remove #react-native-masked-view/masked-view package and try build.
https://github.com/react-native-masked-view/masked-view/issues/100#issuecomment-841634389 Thanks to: Navipro70

Strange error when upgrading play-services-auth from 15.0.0 to 16.0.1

For my android project I upgraded play-services-auth library version from 15.0.0 to 16.0.1
Since then I see following error during the build and it also produces
ajcore files
I have removed my .gradle caches and done build and still see this error.
Anybody else seen this before, how do I fix it?
java.lang.IllegalStateException: Expecting .,<, or ;, but found authapi while unpacking Lcom/google/android/gms/common/api/internal/BaseImplementation$ApiMethodImpl;
at org.aspectj.util.GenericSignatureParser.parseClassTypeSignature(GenericSignatureParser.java:204)
at org.aspectj.util.GenericSignatureParser.parseFieldTypeSignature(GenericSignatureParser.java:155)
at org.aspectj.util.GenericSignatureParser.parseTypeArgument(GenericSignatureParser.java:267)
In my case, removing the Hugo logging plugin fixed the issue.
Check in your gradle file if you have it configured.
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
It happens because some plugin (added by you) use libs:
org.aspectj:aspectjtools
or
org.aspectj:aspectjrt for codegeneration

Error using mismatched PostCSS dependencies

Anyone know how to get composes working in gatsby css modules.
I've tried using.
.dog {
composes: dog from "styles/common.scss"
}
I get this error.
Your current PostCSS version is 5.2.18, but postcss-nesting uses
6.0.23. Perhaps this is the source of the error below.
I've tried installing postcss-nesting
But that doesn't seem to stop the above error in gatsby
Your current PostCSS version is 5.2.18, but postcss-nesting uses 6.0.23. Perhaps this is the source of the error you're running into.
Try upgrading PostCSS to at least 6.0

Lots of Flow errors in React Native project

I created a React Native project from Expo. Then I wanted to add Flow to it. I noticed in my node_modules/react-native folder there was a .flowconfig so I copied that to the root of my project. After running flow I got some warnings from files in node_modules/exponent so I added an ignore for that whole folder. Afterwards, I still get many errors when running flow. Here are a few:
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:227
227: /* $FlowFixMe */
^^^^^^^^^^^^^^^^ Error suppressing comment. Unused suppression
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:1120
1120: if (__DEV__) {
^^^^^^^ identifier `__DEV__`. Could not resolve name
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:2162
2162: if (__DEV__) {
^^^^^^^ identifier `__DEV__`. Could not resolve name
Expo SDK version: 14.0.0
Flow version: 0.37.0
React Native version: 0.41.2
You can suppress errors in .flowconfig file, in [options] section as follows:
[options]
suppress_type=$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-8]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
Then, in [libs] section, you should point so called library definition file, like:
[libs]
./libdefs.js
And in libdefs.js just declare:
declare var __DEV__:string;
These changes should resolve your errors. See:
https://flow.org/en/docs/config/options/#toc-suppress-comment-regex and
https://flow.org/en/docs/libdefs/creation/ for details.
Looks like it might have been an oversight on the flow types for that release version.
All of those errors look fairly harmless though so you could just ignore it. If you absolutely cannot ignore it, update to a later version of React Native that's locked to a different version of Flow? I've had good results personally (no errors) with React Native # 0.42 and Flow # 0.38.
Found this issue which recommended updating the flowconfig to use the latest version from create-react-native-app. Seems to have worked for me.

flowtype errors in base AwesomeProject

I recently wanted to reset a react-native project to most recent version, and so I initialised the seed project - "AwesomeProject"... The problem is that it comes with 19 flowtype errors "out of the box"
node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationCardStackStyleInterpolator.js
lines:91,94,97,104,107,137,142,148
node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationHeaderStyleInterpolator.js
lines:57,68,74,87,94
node_modules/react-native/Libraries/Experimental/WindowedListView.js
lines:629, 629, 665,665
node_modules/react-native/Libraries/Image/Image.ios.js
line:272
I am reluctant to make changes to these files as it may create knock on effects. Does anyone have a work around?
In general, whenever you want flow to ignore a file, you can just specify that file under the [ignore] section of your .flowconfig.
That said, I just react-native init'd a project, using react-native-cli 1.0.0 and react-native 0.29.1, and ran a flow server on the root of my project, and didn't get any errors.