Repository navigation
firebase_messaging 5.1.5 - When using onBackgroundMessage, i get Exception: Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference #160
Copy link
Copy link
Closed
Labels
resolution: duplicateThis issue or pull request already existsThis issue or pull request already existstype: bugSomething isn't workingSomething isn't working
Description
i followed the instractions from the section "Optionally handle background messages" on
https://pub.dev/packages/firebase_messaging/versions/5.1.5
When using onBackgroundMessage, i get Exception: "Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference"
my stack trace:
Launching lib\main.dart on COR L29 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
E/ (29819): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
E/ (29819): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
Syncing files to device COR L29...
D/AwareBitmapCacher(29819): handleInit switch not opened pid=29819
D/ZrHung.AppEyeUiProbe(29819): notify runnable to start.
D/ZrHung.AppEyeUiProbe(29819): restart watching
I/OpenGLRenderer(29819): Initialized EGL, version 1.4, mEglDisplay 0x1
D/OpenGLRenderer(29819): Swap behavior 2
D/mali_winsys(29819): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/mali_winsys(29819): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
W/libEGL (29819): EGLNativeWindowType 0x7caf56e010 disconnect failed
D/mali_winsys(29819): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/ViewRootImpl(29819): jank_removeInvalidNode jank list is null
W/InputMethodManager(29819): startInputReason = 1
W/InputMethodManager(29819): startInputReason = 5
I/tter_client_ap(29819): Starting profile saver IsSaveProfileNow end.
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): Failed to handle method call
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at vn.hunghd.flutterdownloader.FlutterDownloaderPlugin.registerWith(FlutterDownloaderPlugin.java:67)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:50)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at com.softenware.flutter_client_app.Application.registerWith(Application.java:18)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.startBackgroundIsolate(FlutterFirebaseMessagingService.java:164)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.onMethodCall(FirebaseMessagingPlugin.java:133)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at android.os.MessageQueue.next(MessageQueue.java:386)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at android.os.Looper.loop(Looper.java:175)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at android.app.ActivityThread.main(ActivityThread.java:7625)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/MethodChannel#plugins.flutter.io/firebase_messaging(29819): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
E/flutter (29819): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.app.Application android.app.Activity.getApplication()' on a null object reference, null)
E/flutter (29819): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (29819): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33)
E/flutter (29819): <asynchronous suspension>
E/flutter (29819): #2 FirebaseMessaging.configure (package:firebase_messaging/firebase_messaging.dart:118:16)
E/flutter (29819): #3 _MeetAppHomeState.initState (package:flutter_client_app/meet_app_home.dart:74:24)
E/flutter (29819): #4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4068:58)
E/flutter (29819): #5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5)
E/flutter (29819): #6 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #8 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14)
E/flutter (29819): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #11 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (29819): #12 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (29819): #13 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5)
E/flutter (29819): #14 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5)
E/flutter (29819): #15 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #17 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14)
E/flutter (29819): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #20 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14)
E/flutter (29819): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #22 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5233:32)
E/flutter (29819): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #25 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (29819): #26 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (29819): #27 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5)
E/flutter (29819): #28 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11)
E/flutter (29819): #29 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5)
E/flutter (29819): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #32 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14)
E/flutter (29819): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #35 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (29819): #36 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (29819): #37 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3924:5)
E/flutter (29819): #38 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4088:11)
E/flutter (29819): #39 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3919:5)
E/flutter (29819): #40 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3101:14)
E/flutter (29819): #41 Element.updateChild (package:flutter/src/widgets/framework.dart:2904:12)
E/flutter (29819): #42 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5127:14)
E/flutter (29819): #43 Element.inflateWidget (package:flutter/src/widgets/framework.dart:
W/InputMethodManager(29819): startInputReason = 8
W/IInputConnectionWrapper(29819): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(29819): getTextBeforeCursor on inactive InputConnection
D/ZrHung.AppEyeUiProbe(29819): stop checker.
E/ (29819): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
W/libEGL (29819): EGLNativeWindowType 0x7caf56f010 disconnect failed
D/ViewRootImpl[MainActivity](29819): surface should not be released
V/ActivityThread(29819): Handle window ActivityRecord{67cd645 token=android.os.BinderProxy@1f79dde {com.softenware.flutter_client_app/com.softenware.flutter_client_app.MainActivity}} visibility: false
W/libEGL (29819): EGLNativeWindowType 0x7caf56e010 disconnect failed
D/ZrHung.AppEyeUiProbe(29819): Current Activity:false
D/ZrHung.AppEyeUiProbe(29819): not watching, wait.
E/ (29819): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
resolution: duplicateThis issue or pull request already existsThis issue or pull request already existstype: bugSomething isn't workingSomething isn't working
Activity
BondarenkoStas commentedon Sep 17, 2019
Duplicate of #145
Thank you for your input, but closing it. Another issue will a reference to this one. If you disagree, feel free to comment and I will reopen the issue.
YonatanAmitzur commentedon Sep 18, 2019
i managed to get to a point where i dont get the error, for some reason when i removed flutter_downloader: ^1.1.7 from pubspec.ymal (update to ^1.1.7 did not helped)
but when i put the app in the background and i am getting a push notification, the onBackgroundMessage handler is not invoke
can some please explain (due to no documentation), when does the onBackgroundMessage handler supposed to be fire ?
NoamDev commentedon Sep 19, 2019
@YonatanAmitzur
can anyone please edit this issue to make sure it doesn't reference any issue and pull request in this site??
for example: format it as code:
insert the hole stack trace into ``` ``` or select it and click the insert code button.
badf007 commentedon Sep 23, 2019
I'm using Flutter and I'm looking at the "[ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]" that @YonatanAmitzur is having too at the start of the error log, same to other people and is nice to notice that the device used has the ID: COR L29 that's an Honor Play phone and the device that I'm having issues with has the ID: SNE LX3 and is a Huawei Mate 20. The issues look like is device related to this Honor/Huawei because of other people with similar devices having this issue.
worldpotato commentedon Oct 1, 2019
@badf007 can confirm that for STF L09 aka Honor9.
ChristianRagmat commentedon Nov 16, 2019
#145 has been closed as a duplicate of #88
Please re-open this as might not be related to #88
This issue is I think experienced when using FCM with other plugins. We were able to replicate this when we used nfet.net printing package.
In the case of this bug. it was the Downloader package