-
Notifications
You must be signed in to change notification settings - Fork 212
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
PlatformException when calling OneSignal.setAppId on Android #494
Comments
I have the same problem, any solution ? |
I noticed that the issue happens when clicking on home button and the app in the background, then getting back to the app again |
I have the same problem. |
Getting same error after trying this solution |
After downgrading to 3.1.0 we are no longer seeing this issue reported. |
I have the same issue |
Thanks for reporting, we will investigate the |
same issue |
1 similar comment
same issue |
Quick update for those following this issue. There is a pull request which fixes an underlining issue with the native OneSignal-Android-SDK this OneSignal-Flutter-SDK depends on. The issue was reproduced consistently via a unit test, a fix was implemented, and the test was re-run to confirm the fix. We will be prioritizing a release to get this fix rolled out quickly. |
This is now fixed and is part of the OneSignal-Flutter-SDK 3.2.8 Release. |
Description:
Seeing platform exceptions reported through Sentry when setting the app id during app start up on Android.
Seen on Android 9,10, and 11.
Environment
onesignal_flutter: ^3.2.3
Flutter 2.5.1
Steps to Reproduce Issue:
Unfortunately have not been able to replicate this locally yet.
Anything else:
Exception details
PlatformException: PlatformException(error, Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference at com.onesignal.r1.d(OSObservable.java:3) at com.onesignal.v2.O1(OneSignal.java:3) at com.onesignal.flutter.OneSignalPlugin.r(OneSignalPlugin.java:1) at com.onesignal.flutter.OneSignalPlugin.K(OneSignalPlugin.java:7) at com.onesignal.flutter.OneSignalPlugin.onMethodCall(OneSignalPlugin.java:2) at e.a.c.a.j$a.a(MethodChannel.java:2) at io.flutter.embedding.engine.f.b.e(DartMessenger.java:4) at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:2) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loop(Looper.java:206) at android.app.ActivityThread.main(ActivityThread.java:8595) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) ) File "message_codecs.dart", line 607, in StandardMethodCodec.decodeEnvelope File "platform_channel.dart", line 156, in MethodChannel._invokeMethod File "<asynchronous suspension>" File "onesignal_flutter.dart", line 63, in OneSignal.setAppId File "<asynchronous suspension>" File "notificationHelper.dart", line 29, in NotificationHelper.init File "<asynchronous suspension>" File "app.dart", line 38, in _MyAppState.initPlatformState
Have taken a look through the code to try identify the issue. It is possibly related to the changes in #445. In the Android SDK (if I have interpreted correctly) it appears that the "removeObserver" function does not account for if a weak reference has been cleared so possibly this is the root cause? https://github.com/OneSignal/OneSignal-Android-SDK/blob/main/OneSignalSDK/onesignal/src/main/java/com/onesignal/OSObservable.java#L58. Will downgrade to 3.1.0 to try and confirm this is the case.
The text was updated successfully, but these errors were encountered: