I am currently trying to implement notifications using the flutter_local_notifications package. It works fine working using the Local Run feature of the desktop app, however when I try to deploy to the internal track in Google Play, or build an APK using the interface, the app either hangs at the initialization of the package, or won't allow me to set a new notification.
Using adb logcat
I discovered the following error: [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(invalid_icon, The resource @mipmap/ic_launcher could not be found. Please make sure it has been added as a drawable resource to your Android head project., null, null)
context: To initialize flutter_local_notifications I have to set the default icon using AndroidInitializationSettings('icon_name');
where icon_name would be the android:icon
setting in androidmanifest.xml, or a custom added drawable. In Flutterflow code exports, this is '@mipmap/ic_launcher', which works fine using local run.
It appears that the codemagic pipeline that builds the APK or release, changes the name or reference to this image, leading to the aforementioned error.
Does anyone know how I could refer to the launcher icon in a way it doesn't crash?
flutter_local_notifications icon issue
Custom Code
I've tried '@mipmap/ic_launcher' with and without @
I've inspected the built APK and attempt to refer to the generated reference in androidmanifest.xml (
android:icon="@ref/0x7f0c0001"
)I've tried '@mipmap/ic_launcher_foreground', as that's what the name seems to be in FlutterFlow
I've tried setting
AndroidInitializationSettings('app_icon');
Yes
2
1 reply