OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
621 stars 212 forks source link

OneSignal Not Initializing [Bug]: com.amazon.device.iap.internal.d #709

Closed jabirmayar closed 1 year ago

jabirmayar commented 1 year ago

What happened?

i have in main function ` OneSignal.Debug.setLogLevel(OSLogLevel.fatal);

OneSignal.initialize("appid");

OneSignal.Notifications.requestPermission(true);`

Steps to reproduce?

Add the latest version of package. 
Initialize onesignal
run app

What did you expect to happen?

For appsignal to initialize and login user external id

OneSignal Flutter SDK version

5.0.0

Which platform(s) are affected?

Relevant log output

`/MethodChannel#OneSignal( 3124): Failed to handle method call
E/MethodChannel#OneSignal( 3124): java.lang.IllegalArgumentException: Expected receiver of type com.amazon.device.iap.internal.d, but got kotlin.Unit
E/MethodChannel#OneSignal( 3124):   at java.lang.reflect.Field.get(Native Method)
E/MethodChannel#OneSignal( 3124):   at com.onesignal.core.internal.purchases.impl.TrackAmazonPurchase.start(TrackAmazonPurchase.kt:83)
E/MethodChannel#OneSignal( 3124):   at com.onesignal.core.internal.startup.StartupService.start(StartupService.kt:16)
E/MethodChannel#OneSignal( 3124):   at com.onesignal.internal.OneSignalImp.initWithContext(OneSignalImp.kt:247)
E/MethodChannel#OneSignal( 3124):   at com.onesignal.OneSignal.initWithContext(OneSignal.kt:126)
E/MethodChannel#OneSignal( 3124):   at com.onesignal.flutter.OneSignalPlugin.initWithContext(OneSignalPlugin.java:128)
E/MethodChannel#OneSignal( 3124):   at com.onesignal.flutter.OneSignalPlugin.onMethodCall(OneSignalPlugin.java:111)
E/MethodChannel#OneSignal( 3124):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#OneSignal( 3124):   at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#OneSignal( 3124):   at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#OneSignal( 3124):   at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#OneSignal( 3124):   at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#OneSignal( 3124):   at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#OneSignal( 3124):   at android.os.Looper.loop(Looper.java:268)
E/MethodChannel#OneSignal( 3124):   at android.app.ActivityThread.main(ActivityThread.java:8019)
E/MethodChannel#OneSignal( 3124):   at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#OneSignal( 3124):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
E/MethodChannel#OneSignal( 3124):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
I/System.out( 3124): [okhttp]:check permission begin!
I/System.out( 3124): [okhttp]:not MMS!
I/System.out( 3124): [okhttp]:not Email!
/flutter ( 3124):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)
E/flutter ( 3124): )
E/flutter ( 3124): #0      StandardMethodCodec.decodeEnvelope
message_codecs.dart:652
E/flutter ( 3124): #1      MethodChannel._invokeMethod
platform_channel.dart:310
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124):
E/flutter ( 3124): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method OneSignal#lifecycleInit on channel OneSignal#inappmessages)
E/flutter ( 3124): #0      MethodChannel._invokeMethod
platform_channel.dart:308
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124): #1      OneSignalInAppMessages.lifecycleInit
inappmessages.dart:77
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124):
E/flutter ( 3124): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method OneSignal#pushSubscriptionToken on channel OneSignal#pushsubscription)
E/flutter ( 3124): #0      MethodChannel._invokeMethod
platform_channel.dart:308
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124): #1      OneSignalPushSubscription.lifecycleInit
pushsubscription.dart:65
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124):
E/flutter ( 3124): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method OneSignal#permission on channel OneSignal#notifications)
E/flutter ( 3124): #0      MethodChannel._invokeMethod
platform_channel.dart:308
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124): #1      OneSignalNotifications.lifecycleInit
notifications.dart:121
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124):
E/flutter ( 3124): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method OneSignal#requestPermission on channel OneSignal#notifications)
E/flutter ( 3124): #0      MethodChannel._invokeMethod
platform_channel.dart:308
E/flutter ( 3124): <asynchronous suspension>
E/flutter ( 3124): #1      OneSignalNotifications.requestPermission
notifications.dart:91
E/flutter ( 3124): <asynchronous suspension>`

Code of Conduct

ghost commented 1 year ago

same issue

KostyaLocal commented 1 year ago

Same issue on MIUI on real device

MobIS1User commented 1 year ago

same issue for us

Aboneyx commented 1 year ago

same issue

Chhay67 commented 1 year ago

same issue. any solution ????

Aboneyx commented 1 year ago

same issue. any solution ????

rolled back to version 3.5.1

ewingapp commented 1 year ago

Same issue here, seems like no clear solution right now beside rolling back to previous version

KostyaLocal commented 1 year ago

Same issue here, seems like no clear solution right now beside rolling back to previous version

I've rolled back too. Now I have problems with OneSignal.shared.setExternalUserId , OneSignal.shared.setEmail, OneSignal.shared.removeExternalUserId. They just take a long time to call

OneSignal is so buggy, are there any alternatives with full Flutter support?

metalwings commented 1 year ago

Same issue here. Version 5.0.0 works on iOS but causes android to crash.

Downgrading to https://pub.dev/packages/onesignal_flutter/versions/3.5.1 works for now.

jabirmayar commented 1 year ago

3.5.1 works, yes. but I would really like to use the latest as I already changed everything and i don't want to rollback. So I guess will have to wait for a fix.

kryptamine commented 1 year ago

same issue here

khurramaleee commented 1 year ago

Same issue crashing in release mode

jblankenship5 commented 1 year ago

Updated all my code to new version just to have to rollback Zzz..

emawby commented 1 year ago

Thank you for reporting this is likely a "minify" issue with the Android native SDK. The fix should be available soon thank you for your patience!

abudawud commented 1 year ago

same issue when running the app on release mode flutter run --release. but it's work fine on debug mode flutter run

rafael-mq commented 1 year ago

Check this answer on another issue: https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/725#issuecomment-1710603403

MaximilianFlechtner commented 1 year ago

+1

giovanni256 commented 1 year ago

Check this answer on another issue: #725 (comment)

Not working for this issue, +1

emawby commented 1 year ago

Thank you for reporting we are working on a fix for this asap!

sharprockventures commented 1 year ago

Thanks @emawby! I am having the same issue and just found this thread. Glad you guys are working on it!

akanxa commented 1 year ago

same issue any solution?

talkbiz commented 1 year ago

Same issue

acvxx commented 1 year ago

same issue

KodyKendall commented 1 year ago

Is there a short term workaround? I am running into this issue for the react-native SDK as well.

akanxa commented 1 year ago

same issue

tuantung commented 1 year ago

Same issue. iOS works fine. Only crashes with Android

nan-li commented 1 year ago

Hi everyone,

Can you let me know if you are using any other in-app purchasing or purchases-related SDK in your app? And if you use Amazon IAP SDK?

akanxa commented 1 year ago

Hi @nan-li, I used purchases_flutter, and it is working well after commenting this library.

MobIS1User commented 1 year ago

Hi everyone,

Can you let me know if you are using any other in-app purchasing or purchases-related SDK in your app? And if you use Amazon IAP SDK?

We do not use any of those things in our Flutter app. Thanks for looking into it!

jabirmayar commented 1 year ago

Hi everyone,

Can you let me know if you are using any other in-app purchasing or purchases-related SDK in your app? And if you use Amazon IAP SDK?

I am using purchases_flutter from RevenueCat. I will look into if this is what causing the issue.

nan-li commented 1 year ago

Hi @akanxa, the OneSignal SDK works successfully if you remove purchases_flutter?

This is helpful information to help us resolve this bug.

harryt2 commented 1 year ago

Possibly related: after removing RevenueCat's sdk mine started working again. Using Ionic Vue Capacitor and the Cordova plugin.

Klyado commented 1 year ago

Same here with RevenueCat installed. It causes issues and breaks everything.
I'm using Expo SDK but I guess that's the same problem.

acvxx commented 1 year ago

Hi everyone,

Can you let me know if you are using any other in-app purchasing or purchases-related SDK in your app? And if you use Amazon IAP SDK?

I'm using both the "in_app_purchase" package and the "purchases_flutter" package. OneSignal SDK started working correctly after I removed the "purchases_flutter" package from RevenueCat.

akanxa commented 1 year ago

Hi @akanxa, the OneSignal SDK works successfully if you remove purchases_flutter?

This is helpful information to help us resolve this bug.

Hi @akanxa, the OneSignal SDK works successfully if you remove purchases_flutter?

This is helpful information to help us resolve this bug.

Yes it perfectly working after removing 'purchase_flutter'

vegaro commented 1 year ago

I work at purchases-flutter. I've been looking into this, and I believe the issue is in this line https://github.com/OneSignal/OneSignal-Android-SDK/blob/5.0.2/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/purchases/impl/TrackAmazonPurchase.kt#L77.

Method e changed in version 3.0.4 of the Amazon SDK (see https://www.diffchecker.com/mAggUTRG/ )

In 3.0.4

public boolean e() {
        this.h();
        return com.amazon.a.a.a((Application)this.e.getApplicationContext());
}

In 3.0.1, 3.0.2, 3.0.3

public static d e() {
        return c;
 }

purchases-flutter depends on version 3.0.3 of the Amazon Appstore SDK, and it looks like OneSignal-Android compiles against the latest available (3.0.4), so maybe that's where the issue is? That the function is not the same as the one in runtime?

nan-li commented 1 year ago

Hi everyone, thanks for your reports.

We identified the bug in our native Android SDK's code and the fix will be included in the next release.

Thanks @vegaro for pointing out that the appstore v3.0.4 has a method name change. This wasn't the bug we needed to fix, but we used this information to make the SDK now compatible with v3.0.4.

Klyado commented 1 year ago

Hi @nan-li thanks for the good news (and @vegaro for taking a look at it). When will the new version be released? I guess you'll also update the Expo SDK as it also contains the issue?

Thanks again!

nan-li commented 1 year ago

Hi everyone, thanks for your patience.

We released the fix in the latest release of the OneSignal Flutter SDK, please see version 5.0.3.

Please let us know if you have any remaining issues.

michael-joseph-payne commented 1 year ago

image

Still present in 5.0.3

nan-li commented 1 year ago

Hi @michael-joseph-payne,

I cannot tell what the logs show. Is it a crash? Is it a "method not found" error? Is it an log from OneSignal or is it a log from Amazon Appstore SDK?

The crash users reported is java.lang.IllegalArgumentException: Expected receiver of type com.amazon.device.iap.internal.d, but got kotlin.Unit which has been fixed in 5.0.3.

burakcbdn commented 11 months ago

still gettiing this error on 5.0.4

E/DartMessenger(28499): Uncaught exception in binary message listener
E/DartMessenger(28499): java.lang.Exception: Must call 'initWithContext' before use
E/DartMessenger(28499):     at com.onesignal.internal.OneSignalImp.getNotifications(OneSignalImp.kt:91)
E/DartMessenger(28499):     at com.onesignal.OneSignal.getNotifications(OneSignal.kt:62)
E/DartMessenger(28499):     at com.onesignal.flutter.OneSignalNotifications.registerClickListener(OneSignalNotifications.java:195)
E/DartMessenger(28499):     at com.onesignal.flutter.OneSignalNotifications.onMethodCall(OneSignalNotifications.java:74)
E/DartMessenger(28499):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/DartMessenger(28499):     at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/DartMessenger(28499):     at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/DartMessenger(28499):     at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/DartMessenger(28499):     at android.os.Handler.handleCallback(Handler.java:938)
E/DartMessenger(28499):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger(28499):     at android.os.Looper.loop(Looper.java:246)
E/DartMessenger(28499):     at android.app.ActivityThread.main(ActivityThread.java:8653)
E/DartMessenger(28499):     at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(28499):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/DartMessenger(28499):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
LiLatee commented 3 months ago

Hi! I am also receiving that issue on Android using package version 5.2.2 We also use in-app purchase packages in the project.

  in_app_purchase: ^3.1.13
  in_app_purchase_android: any
  in_app_purchase_platform_interface: any
  in_app_purchase_storekit: any
  in_app_review: ^2.0.9
E/DartMessenger(10972): Uncaught exception in binary message listener
E/DartMessenger(10972): java.lang.Exception: Must call 'initWithContext' before use
E/DartMessenger(10972):     at com.onesignal.internal.OneSignalImp.getUser(OneSignalImp.kt:119)
E/DartMessenger(10972):     at com.onesignal.OneSignal.getUser(OneSignal.kt:46)
E/DartMessenger(10972):     at com.onesignal.flutter.OneSignalUser.setLanguage(OneSignalUser.java:70)
E/DartMessenger(10972):     at com.onesignal.flutter.OneSignalUser.onMethodCall(OneSignalUser.java:36)
E/DartMessenger(10972):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/DartMessenger(10972):     at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/DartMessenger(10972):     at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/DartMessenger(10972):     at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/DartMessenger(10972):     at android.os.Handler.handleCallback(Handler.java:958)
E/DartMessenger(10972):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger(10972):     at android.os.Looper.loopOnce(Looper.java:205)
E/DartMessenger(10972):     at android.os.Looper.loop(Looper.java:294)
E/DartMessenger(10972):     at android.app.ActivityThread.main(ActivityThread.java:8177)
E/DartMessenger(10972):     at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(10972):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/DartMessenger(10972):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

EDIT: Sorry wrong issue. I had to init OneSignal before calling setLanguage.