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

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

Closed
saravananmnm opened this issue Oct 29, 2020 · 6 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. closed-by-bot Stale Issue with no recent activity

Comments

@saravananmnm
Copy link

saravananmnm commented Oct 29, 2020

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)

@saravananmnm saravananmnm 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). Oct 29, 2020
@saravananmnm saravananmnm 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). Oct 29, 2020
@saravananmnm saravananmnm 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 Oct 29, 2020
@saravananmnm
Copy link
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
Copy link

@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.

@darshankawar darshankawar added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 30, 2020
@darshankawar darshankawar 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 Oct 30, 2020
@saravananmnm
Copy link
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

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 31, 2020
@Salakar Salakar added blocked: customer-response Waiting for customer response, e.g. more information was requested. no-template labels Nov 3, 2020
@darshankawar
Copy link

@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>

---

@darshankawar darshankawar removed the Needs Attention This issue needs maintainer attention. label Nov 4, 2020
@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Nov 13, 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.

@firebase firebase locked and limited conversation to collaborators Dec 25, 2020
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
Projects
None yet
Development

No branches or pull requests

4 participants