-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] launch_icon with flavors not working #385
Comments
PD: I can share and add more info if needed, did not know exactly what info to add |
Can you please try with these changes in flutter_icons:
android: true # should be bool or path to icon
ios: true
image_path: "assets/adaptive_app_icon/pre.png" # path icon
remove_alpha_ios: true |
Yup, I've tried with no luck I'm afraid... |
A couple of questions: After changing or adding new icons, I ran |
Can you provide me with these details
if it is # only generates icons for android platform
flutter_icons:
android: true # should be bool or path to icon
ios: false
image_path_android: "assets/adaptive_app_icon/pre.png" #<- image path for android |
It seems it's happening on all platforms. I've checked and the icons are generated correctly inside I did update flutter, a month or two back, from 2.7.3 to 3.0.2. The above config should go in the pubspec.yml or inside
|
Maybe there is a problem with the build cache try running flutter clean &&
flutter pub get &&
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-pre.yaml |
Okay, I will try that. I think I tried it as well, but maybe not!! I'll let you know! |
When running the above commands it gives me the same error as above, with the config you suggested. this is the complete output:
|
Can you try with this?
flutter_icons:
android: true # should be bool or path to icon
ios: true
image_path: "assets/adaptive_app_icon/pre.png" # path icon
remove_alpha_ios: true flutter clean &&
flutter pub get &&
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-pre.yaml |
Hey, I just tried this as well with no luck. It's still showing the incorrect icon... This weekend I will create a project from 0 and try to replicate this behaviour there and share it with you guys. I've tried a lot of things and the project is quite big, so there might be something wrong somewhere I can't find. |
Hey there, I was just doing some tests and tried adding a new flavor. This new flavor works as expected, but the old ones still don't... I've deduced that for some reason, the old flavors use the |
Ok, I've detected something weird. It seems this only happens on devices that installed the app prior to changing icons. If I try with new devices the icons are shown correctly, with old devices it always shows the first icon it had, even after removing the app and clearing the cache. How does this make sense? Do you know if android caches this in some way? |
Maybe it depends on the android skin. Each skin has there own optimizations. Try restarting your device, it should work most of the time |
I tried but there's no luck. Oh well, I will blame it on android. As it's happened to more than one type of skin. I will keep investigating and if I find the reason I will make sure to update you. |
Try testing them on the android emulator |
I've also run in to this issue. I can see that the icons are generated and placed in the correct folders. I have a suspicion that it might not being built correctly when building the app with the --flavor flag. It falls back to the default app-icon instead of the flavor-app-icon. To solve it on Mac (xcode) it is required to change it direclty in xcode every time you need to change flavor. Is there some trick to force xcode/android-studio to take the flavor-app-icons (like e.g. add an additional build-flag or something) ? |
I had to manually go into Targets Runner -> Build Settings -> Search for "Primary App Icon Set" and then put in the name of the asset as specified in the asset catalog for each type The flavorizr library supports it correctly on iOS (but doesn't handle dynamic icons on Android...). Might be able to take inspiration from them on how they update the flavors in the ios icon processors. |
Nice find! Works like a charm :) |
hey, I had the same issue like @nombrekeff. I fixed it quite easily but simply just removing the ic_launcher_foreground.xml file from the android/app/src/main/res/drawable folder. Somehow this always overwrote the other generated foreground files within the different flavors |
@nombrekeff I was facing the same issue and after deleting all the |
In case if it helps. Renaming this particular file solved the issue for me. This looks to be similar to what @gonzasosa did. Thanks! |
Same issue
Assets are created inside
I've deleted main/res but same issue. flutter_launcher_icons: 0.12.0 |
It worked! Just because the asset is set |
@nombrekeff by any chance did you use |
Hey @MarkOSullivan94, I'm afraid I did not. I created the project using the Flutter starter package as specified in their docs. |
@nombrekeff does this help you? If not, might be good to try and create an open source project with a similar setup so I can help identify the issue |
This worked for me but I renamed the flavor file and it reloaded the flavor icon correctly |
So for me, none of the above solutions solved the problem. SetupIn my project, I have 2 flavors:
For some reason when running the command: ProblemIn the In the If we take a look at my <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.your_project">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon" <!-- RIGHT HERE -->
android:label="Your Project">
<activity ...>
<meta-data ...>
<meta-data ...>
<meta-data ...>
</application>
</manifest> SolutionSo the solution is to rename every file from Be aware that it is not just I hope this is helpful. |
This works |
ℹ️ Info
Version:
0.9.3
Flutter version: 3.0.2
💬 Description
We have been using this package for a while, it worked perfectly until a couple of weeks ago. I've checked everything and it all seems correct. The issue is that when installing the app it always show the default launcher_icon instead of the one defined in
flutter_launcher_icons-<flavor>.yaml
I've got 3 flavours, pre, prod and sandbox. But if I run
flutter run --flavor sandbox
, the app shows the default icon. Not the one defined in that flavor configuration file.I've run
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-sandbox.yaml
but it does not solve anything. Any idea what could be going on?I had it set up with adaptive icons, but for testing, I tried with
image_path
instead.📜 Pubspec.yaml
Flavor file example
flutter_launcher_icons-pre.yaml
build.gradle
The text was updated successfully, but these errors were encountered: