-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[firebase_messaging] Android v2 embedding crashes #1754
Comments
Closing this. Seems that I had left |
I have the exact same issue. The app crashes when I receive a notification while the app is closed, but I get the notification when the app is running. I migrated the app using the upgrade guide. I tried adding |
Please reopen the issue because the problem still remain |
Please reopen the issue I am facing the same thing as well! |
Reopened. Should not have closed it. |
Anyone with a solution for this? Having the same problem. |
I'm seeing this also |
I have the same problem |
The bug happens because the plugin still calling
So the " Until this is fixed, you can get around the error by making your app use the old |
I'm having this issue too, unfortunately I can't go back and revert the v2 embedding implementation in my app because other plugins depend on it to work properly. Any chance to fix this soon? This issue is quite old now... |
I'm having the same issue too! Can we get it fixed soon? |
Having the same issue and it is impacting a large percentage of our users. Would appreciate a speedy fix :) |
I'm having this issue as well |
You may as well try the workaround I described in my post above. Just to clarify, this workaround does NOT require you to revert your project to pre-v2. |
@ryanheise How about those in GeneratedPluginRegistrants? Some of my package use those do I need to include that in MainActivity.kt? |
Is there any information in regards to a release with a fix for this issues? Right now it's crashing always, as soon as the app isn't running at all (so e.g. killed by the system or swiped out of the app switcher). So the user will get crash dialogs over and over, for every push message he receives. This is something highly critical and would block any production release of an app (IMHO). Btw. thanks for the nice plugins and all the efforts integrating Flutter into the existing Firebase world. Looking forward to more nice Flutter integrations. 👍 |
Issues related to this problem (it seems that general parts are missing for the Android v2 embedding: setup call adjustments, documentation and some internal handling e.g. for plugin calls in the onBackgroundMessage method):
Only did a really short search, so probably there are more related issues. Just wanted to show that this problem is probably affecting a larger number of developers and users than visible in this particular ticket. |
Why is this not labelled |
I don't know how but I solved it mysteriously. 🧐 |
#2510 also seems to be related. Please - PRETTY PLEASE make this is a priority. |
#2468 also seems to be related. |
I was able to fix this issue when pressing on notifications by doing this, but please read the entire post before continuing. This is what fixed the issue for me: Here is my application tag
My primary activity for the app is this
I also included these tags under application, among other various widgets.
I sent a notification through a notification channel "test_channel" using the firebase console and the app did not crash when I pressed the notification; it properly entered the app. I did not test if data was received properly, but I would assume it works because it no longer crashes. https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects Please do test it out for yourself because this goes against the update guidelines which tell you to remove this. |
make sense... let's wait for Elliot input on this. |
Replacing this is the fix that I will use for now: Creating custom Application that extends Flutter Application & adding it to the AndroidManifest.xml Changing the firebase_messaging dependency to:
=>>> This wasn't working for iOS 😑 |
Yeah we've removed a few things (specifically We're going to push another release soon with some more changes. Note; the Firebase SDKs need updating in version so we've also got to bump all other package versions... 😅 |
If you want to try 8.0.0-dev.1 now, you need to put this to app/build.gradle or the build fails:
Not sure if that is fully safe regarding other FlutterFire plugins, but I haven't noticed new issues so far. |
I can't use this plugin with v2 embedding every "solution" in this post did not work for me. I will revert to pre v2 embedding 😢 @Ehesp are there dates when the next dev en stable release will be released? We will release in a couple of weeks. Is that feasible? |
@vanlooverenkoen In the next few days is our plan. We've just got to ensure the SDK upgrades work with everything else, and also it's the Firebase Summit this week so want to make sure there's nothing new landing which will break things :) |
@Ehesp the next few days is for a dev release? or a stable release? |
Hope to see the fix soon... my clients are complaining that app is crashing whenever they receives notification :-( |
Crashes can be fixed by replacing the Application with a custom one that extends FlutterApplication. If you want to receive notifications in the background. revert to pre v2 embedding |
Adding
Fixes crashes provisionally. But that shouldn't be the final solution |
When I put the above line, it stopped crashing... I hope there will not be any side effect of it... Thanks for your time and help @ReniDelonzek |
I have this in my Manifest and I'm still getting crashes whenever I receive a notification....
I'm not even using the onBakgroundMessage callback. By the way, if I remove this from the manifest it stops crashing:
But of course tapping on the notifications does nothing now... |
https://pub.dev/packages/firebase_messaging/versions/8.0.0-dev.2/changelog 8.0.0-dev2 release is available |
@vanlooverenkoen any idea if that fixes this? All I see is:
|
Not sure I will try to migrate in a couple hours. Still working on something else first. |
Sorry, maybe a dumb question but I wanted to test this out ASAP so figured I would ask. I had everything working well, with firebase messages triggered my app updates etc. I had this very random crash though which led me to this thread after getting the bugreport indication about "ensureInitializationComplete must be called after startInitialization". So I just went from version "^7.0.3" to version "8.0.0-dev2". Then I can't compile because something is deprecated I think with FirebaseMessaging. I used to have this: FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); but then the _firebaseMessaging didn't have "configure" or "onIosSettingsRegistered" defined anymore? I see this was deprecated to: FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; but I still can't compile with configure(). In the example it still uses deprecated version I had initially so I'm just at a loss I think with DART syntax I should be using. Any help would be appreciated! |
You can use FirebaseMessaging.onMessage or something like that to get the old methods |
Migration guide & docs will be released soon, however the dev release is good to start using (+ testing). Aside from some local tests failing, you can find everything here: https://github.com/invertase/flutterfire/pull/76 |
Ok, this will take me some time to setup for migration and get the new way of using firebase setup. I'll do that but in the short term if I add the line above:
in my AndroidManifest.xml in the I have two questions.
|
|
@Ehesp Has the data field been tested on iOS? After migrating to 8.0.0-dev2, my iOS notifications are now breaking when testing on iPhone X, iOS 14.1 with profile mode.. I followed the documentation, here's a code snippet.
The previous version when I used .configure() was working perfectly for iOS. Specifically what happens now is that I receive the notification successfully but upon tapping on it, it opens the app but crashes it immediately. |
In the previous version, the data field behaved differently for iOS and Android, where in iOS the data field was missing and the data was combined into the top-level in message instead. Hence in that case I had to catch both scenarios separately.. I'm assuming the new updated plugin is doing that behind-the-scenes? I tried to catch it by casting message to a Map<String,String> when data is null, but that doesn't seem to work for me either. |
Hey all 👋 As part of our roadmap (#2582) we've just shipped a complete rework of the If you can, please try out the dev release (see the migration guide for upgrading and for changes) and if you have any feedback then join in the discussion here. Given the scope of the rework I'm going to go ahead and close this issue in favor of trying out the latest plugin. Thanks everyone. |
When will this fix get to a stable branch? |
New migration guide says that it'll open the app after clicking notification even after removing these Messaging only: If you added the previous versions intent-filter to your android/app/src/main/AndroidManifest.xml file, remove it:
doc link: https://firebase.flutter.dev/docs/migration/ We don't need to create Application.kt or include anything in AndroidManifest |
This one works for me. |
I removed the
|
Describe the bug
Since updating my app to the Android v2 embedding I've been getting reports in Crashlytics concerning
ensureInitializationComplete must be called after startInitialization io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete
.The Flutter 1.12 upgrade guide says to remove all references to the
startInitialization
orensureInitializationComplete
methods but I see 2 references to these methods: here and here.To Reproduce
Steps to reproduce the behavior:
I have not seen the issue when I leave the app open and send the notification.
Expected behavior
Notification displayed normally while app is closed.
Additional context
Here is what the Crashlytics report looks like:
The text was updated successfully, but these errors were encountered: