Skip to content

PID: 21144 java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler on a null object reference #3983

Closed
@saravananmnm

Description

@saravananmnm

2020-10-29 15:55:04.516 21144-21144/com.courieralliance.driverca.qa E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.courieralliance.driverca.qa, PID: 21144
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)

Activity

changed the title [-]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).[/-] [+]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).[/+] on Oct 29, 2020
changed the title [-]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).[/-] [+]PID: 21144 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 referenceW/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).[/+] on Oct 29, 2020
changed the title [-]PID: 21144 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 referenceW/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).[/-] [+]PID: 21144 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[/+] on Oct 29, 2020
saravananmnm

saravananmnm commented on Oct 29, 2020

@saravananmnm
Author

When i kill the application by that time this issue occurred.

`

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
import io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin;
import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin;
import io.flutter.plugins.pathprovider.PathProviderPlugin;
import com.baseflow.geolocator.GeolocatorPlugin;
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"));
    }
    if (!registry.hasPlugin("com.baseflow.geolocator.GeolocatorPlugin")) {
        GeolocatorPlugin.registerWith(registry.registrarFor("com.baseflow.geolocator.GeolocatorPlugin"));
    }

}

}
`

darshankawar

darshankawar commented on Oct 30, 2020

@darshankawar

@saravananmnm
Is this an issue with Firebase plugin ? I can't seem to understand what exactly your issue is. You seem to have lot of 3rd party plugins in above comment.
Please provide flutter doctor -v and minimal code sample that shows the issue you are facing.

changed the title [-]PID: 21144 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[/-] [+]PID: 21144 java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler on a null object reference[/+] on Oct 30, 2020
saravananmnm

saravananmnm commented on Oct 31, 2020

@saravananmnm
Author

Yes @darshankawar.
i think this is a Backward compatibility issue with plugins (v1).

C:\Saravanan\Flutter_Sdk\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel stable, 1.22.1, on Microsoft Windows [Version 10.0.18362.1082], locale en-IN)
• Flutter version 1.22.1 at C:\Saravanan\Flutter_Sdk\flutter
• Framework revision f30b7f4db9 (3 weeks ago), 2020-10-08 10:06:30 -0700
• Engine revision 75bef9f6c8
• Dart version 2.10.1

[√] 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

added
Needs AttentionThis issue needs maintainer attention.
and removed
blocked: customer-responseWaiting for customer response, e.g. more information was requested.
on Oct 31, 2020
darshankawar

darshankawar commented on Nov 4, 2020

@darshankawar

@saravananmnm
Please use the issue template and provide all required details in it to properly analyze this issue. Current details you provided don't help much to proceed further.

Issue Template
## Bug report

**Describe the bug**
A clear and concise description of what the bug is.

### Steps to reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. '...'
4. See error or incorrect behavior

### Expected behavior

A clear and concise description of what you expected to happen.

---

## Additional context

Add any other context about the problem here.

---

### Flutter doctor

Run `flutter doctor` and paste the output below:

<details><summary>Click To Expand</summary>

PASTE OUTPUT INSIDE HERE


</details>

---

### Flutter dependencies

Run `flutter pub deps -- --style=compact` and paste the output below:

<details><summary>Click To Expand</summary>

PASTE OUTPUT INSIDE HERE


</details>

---
google-oss-bot

google-oss-bot commented on Nov 13, 2020

@google-oss-bot

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

google-oss-bot commented on Nov 24, 2020

@google-oss-bot

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.

locked and limited conversation to collaborators on Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleIssue with no recent activityblocked: customer-responseWaiting for customer response, e.g. more information was requested.closed-by-bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Salakar@saravananmnm@google-oss-bot@darshankawar

        Issue actions

          PID: 21144 java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler on a null object reference · Issue #3983 · firebase/flutterfire