Skip to content
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] java.lang.NullPointerException: Attempt to invoke interface method #3767

Closed
saravananmnm opened this issue Oct 5, 2020 · 6 comments · Fixed by #4012
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot Stale Issue with no recent activity type: bug Something isn't working

Comments

@saravananmnm
Copy link

saravananmnm commented Oct 5, 2020

java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
E/AndroidRuntime(19251): 	at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:116)
E/AndroidRuntime(19251): 	at io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.onAttachedToEngine(FirebaseMessagingPlugin.java:60)
E/AndroidRuntime(19251): 	at io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(FirebaseMessagingPlugin.java:51)
E/AndroidRuntime(19251): 	at com.courier_alliance.driver.Application.registerWith(Application.java:22)
E/AndroidRuntime(19251): 	at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.startBackgroundIsolate(HeadlessTask.java:150)
E/AndroidRuntime(19251): 	at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.dispatch(HeadlessTask.java:101)
E/AndroidRuntime(19251): 	at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.run(HeadlessTask.java:95)
E/AndroidRuntime(19251): 	at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime(19251): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(19251): 	at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(19251): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime(19251): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19251): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(19251): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)



Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
E/FirebaseInstanceId(19376): Failed to get FIS auth token
W/FirebaseMessagingPlugin(19376): getToken, error fetching instanceID: 
W/FirebaseMessagingPlugin(19376): java.io.IOException: SERVICE_NOT_AVAILABLE
W/FirebaseMessagingPlugin(19376): 	at com.google.firebase.iid.zzu.then(com.google.firebase:firebase-iid@@20.2.0:16)
W/FirebaseMessagingPlugin(19376): 	at com.google.android.gms.tasks.zzd.run(Unknown Source:5)
W/FirebaseMessagingPlugin(19376): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/FirebaseMessagingPlugin(19376): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/FirebaseMessagingPlugin(19376): 	at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6)
W/FirebaseMessagingPlugin(19376): 	at java.lang.Thread.run(Thread.java:919)
I/flutter (19376): FCM : empty
@saravananmnm saravananmnm added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 5, 2020
@TahaTesser TahaTesser changed the title 🐛 [firebase_messaging] java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference 🐛 [firebase_messaging] java.lang.NullPointerException: Attempt to invoke interface method Oct 6, 2020
@TahaTesser TahaTesser removed the Needs Attention This issue needs maintainer attention. label Oct 6, 2020
@TahaTesser
Copy link

TahaTesser commented Oct 6, 2020

Hi @saravananmnm
Can you please provide your flutter doctor -v your flutter run --verbose, your pubspec.yaml and a complete reproducible minimal code sample
Thank you

@TahaTesser TahaTesser added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 6, 2020
@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Oct 15, 2020
@google-oss-bot
Copy link

Hey @saravananmnm. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link

Since there haven't been any recent updates here, I am going to close this issue.

@saravananmnm if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@saravananmnm
Copy link
Author

2020-10-29 11:38:47.669 6459-6459/com.courieralliance.driverca.qa W/FlutterEnginePluginRegistry: Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@b3b4285) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.FlutterEngine@e5e08da).
2020-10-29 11:38:47.672 6459-6459/com.courieralliance.driverca.qa E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.courieralliance.driverca.qa, PID: 6459
java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:116)
at io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.onAttachedToEngine(FirebaseMessagingPlugin.java:60)
at io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(FirebaseMessagingPlugin.java:51)
at com.courieralliance.driverca.Application.registerWith(Application.java:29)
at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.startBackgroundIsolate(HeadlessTask.java:150)
at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.dispatch(HeadlessTask.java:101)
at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.run(HeadlessTask.java:95)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

--------- beginning of system

@saravananmnm
Copy link
Author

C:\Saravanan\Flutter_Sdk\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18362.1082], locale en-IN)
• Flutter version 1.20.4 at C:\Saravanan\Flutter_Sdk\flutter
• Framework revision fba99f6cf9 (6 weeks ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at C:\Users\Admin\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
Process finished with exit code 0

@saravananmnm
Copy link
Author

When i kill the application this issue occured still now.

`

//import com.transistorsoft.flutter.backgroundfetch.BackgroundFetchPlugin;
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin;
import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin;
import io.flutter.plugins.pathprovider.PathProviderPlugin;
import rekab.app.background_locator.LocatorService;
import com.whelksoft.flutter_native_timezone.FlutterNativeTimezonePlugin;
import com.transistorsoft.flutter.backgroundfetch.BackgroundFetchPlugin;

public class Application extends FlutterApplication implements PluginRegistry.PluginRegistrantCallback {

@Override
public void onCreate() {
    super.onCreate();
    FlutterFirebaseMessagingService.setPluginRegistrant(this);
    BackgroundFetchPlugin.setPluginRegistrant(this);
    LocatorService.setPluginRegistrant(this);
}

@Override
public void registerWith(PluginRegistry registry) {
    // I've only had to add this line to make it work
    if (!registry.hasPlugin("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) {
        FirebaseMessagingPlugin.registerWith(registry.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
    }
    if (!registry.hasPlugin("com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin")) {
        FlutterLocalNotificationsPlugin.registerWith(registry.registrarFor("com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin"));
    }
    if (!registry.hasPlugin("com.transistorsoft.flutter.backgroundfetch.BackgroundFetchPlugin")) {
        BackgroundFetchPlugin.registerWith(registry.registrarFor("com.transistorsoft.flutter.backgroundfetch.BackgroundFetchPlugin"));
    }

    if (!registry.hasPlugin("io.flutter.plugins.pathprovider")) {
        PathProviderPlugin.registerWith(registry.registrarFor("io.flutter.plugins.pathprovider"));
    }
    if (!registry.hasPlugin("io.flutter.plugins.sharedpreferences")) {
        SharedPreferencesPlugin.registerWith(registry.registrarFor("io.flutter.plugins.sharedpreferences"));
    }
    if (!registry.hasPlugin("com.whelksoft.flutter_native_timezone")) {
        FlutterNativeTimezonePlugin.registerWith(registry.registrarFor("com.whelksoft.flutter_native_timezone"));
    }

}

}
`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot Stale Issue with no recent activity type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants