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

[Bug]: java.lang.RuntimeException during android pre-launch report #1752

Open
2 of 3 tasks
SiM07 opened this issue Oct 10, 2024 · 2 comments
Open
2 of 3 tasks

[Bug]: java.lang.RuntimeException during android pre-launch report #1752

SiM07 opened this issue Oct 10, 2024 · 2 comments

Comments

@SiM07
Copy link

SiM07 commented Oct 10, 2024

What happened?

When I run my app on Play Store pre-launch report I have a RunTime exception. When run on my phone the same build it's seems to be ok. Maybe it's an incompatibilty with FB SDK. (react-native-fbsdk-next with version 13.1.3)

Steps to reproduce?

1. Build the App
2. Put in in Play Store
3. Wait Pre-launch report (and maybe some phone ?)
4. See Crashes

What did you expect to happen?

App run normally in the monkey test.

React Native OneSignal SDK version

Release 5.2.5

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

Exception java.lang.RuntimeException: Could not invoke OneSignal.setPrivacyConsentGiven
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:381)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:146)
  at com.facebook.jni.NativeRunnable.run
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:235)
  at java.lang.Thread.run (Thread.java:920)
Caused by java.lang.reflect.InvocationTargetException:
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
Caused by java.lang.reflect.InvocationTargetException:
  at java.lang.reflect.Constructor.newInstance0
  at java.lang.reflect.Constructor.newInstance (Constructor.java:343)
  at com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:89)
  at com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
  at com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
  at com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:82)
  at com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
  at com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
  at com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:82)
  at com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
  at com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
  at com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:82)
  at com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
  at com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
  at com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:82)
  at com.onesignal.common.services.ServiceProvider.getAllServices (ServiceProvider.kt:55)
  at com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:72)
  at com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
  at com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
  at com.onesignal.internal.OneSignalImp.getOperationRepo (OneSignalImp.kt:498)
  at com.onesignal.internal.OneSignalImp.setConsentGiven (OneSignalImp.kt:74)
  at com.onesignal.OneSignal.setConsentGiven (OneSignal.kt:111)
  at com.onesignal.rnonesignalandroid.RNOneSignal.setPrivacyConsentGiven (RNOneSignal.java:252)
Caused by java.lang.NullPointerException:
  at com.onesignal.core.internal.application.impl.ApplicationService.getAppContext (ApplicationService.kt:40)
  at com.onesignal.core.internal.preferences.impl.PreferencesService.getSharedPrefsByName (PreferencesService.kt:234)
  at com.onesignal.core.internal.preferences.impl.PreferencesService.get (PreferencesService.kt:134)
  at com.onesignal.core.internal.preferences.impl.PreferencesService.getString (PreferencesService.kt:42)
  at com.onesignal.common.modeling.ModelStore.load (ModelStore.kt:170)
  at com.onesignal.common.modeling.SimpleModelStore.<init> (SimpleModelStore.kt:23)
  at com.onesignal.core.internal.config.ConfigModelStore.<init> (ConfigModelStore.kt:8)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jaks2002
Copy link

jaks2002 commented Oct 11, 2024

expo version 51.0.34
Same issue version 5.2.4 any solutions?

@SiM07
Copy link
Author

SiM07 commented Oct 11, 2024

My initialization was :

OneSignal.setConsentRequired(false);
OneSignal.setConsentGiven(true);
OneSignal.initialize(Config.ONE_SIGNAL_APP_ID!);

This solution works but I don't understand why.

OneSignal.setConsentRequired(false);
OneSignal.initialize(Config.ONE_SIGNAL_APP_ID!);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants