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]: Multiple errors on initOneSignal SDK #1869

Closed
1 task done
IvanGarza07 opened this issue Oct 14, 2023 · 8 comments
Closed
1 task done

[Bug]: Multiple errors on initOneSignal SDK #1869

IvanGarza07 opened this issue Oct 14, 2023 · 8 comments
Assignees

Comments

@IvanGarza07
Copy link

IvanGarza07 commented Oct 14, 2023

What happened?

The sdk present these errors since version 5.0.0:

  • java.lang.Exception - Unrecognized operation: login-user-from-subscription
  • org.json.JSONException - Value at lon of type java.lang.String cannot be converted to long
  • java.lang.NullPointerException

these happen when execute the OneSignal.initWithContext(context, BuildConfig.ONE_SIGNAL_KEY)

Steps to reproduce?

i dont have idea to reproduce the error

What did you expect to happen?

i expected the SDK initiate normally

OneSignal Android SDK version

5.0.0 and above

Android version

13, 12, 11, 10, 9, 8

Specific Android models

- Samsung Galaxy A10e
- Moto E30
- Samsung Galaxy S8+
- Samsung Galaxy A5
- Model:Realme C21Y
- Poco M4 Pro
- Redmi Note 10 Pro
- Model:Alcatel 3
- Galaxy A10s
- Galaxy S9
- Xiaomi 11T
- Galaxy A32
- Model:TCL 30XE
- Galaxy Note8
- Moto E40
- Motorola One Fusion
- Huawei MediaPad T3 10

Relevant log output

java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:343)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:90)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.internal.OneSignalImp.initWithContext (OneSignalImp.kt:424)
com.onesignal.OneSignal.initWithContext (OneSignal.kt:126)

com.onesignal.core.internal.operations.impl.OperationModelStore.create (OperationModelStore.kt:58)
com.onesignal.core.internal.operations.impl.OperationModelStore.create (OperationModelStore.kt:27)
com.onesignal.common.modeling.ModelStore.load (ModelStore.kt:129)
com.onesignal.core.internal.operations.impl.OperationModelStore.<init> (OperationModelStore.kt:30)
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:343)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:90)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.internal.OneSignalImp.initWithContext (OneSignalImp.kt:424)
com.onesignal.OneSignal.initWithContext (OneSignal.kt:126)

org.json.JSON.typeMismatch (JSON.java:101)
org.json.JSONObject.getLong (JSONObject.java:526)
com.onesignal.common.modeling.Model.initializeFromJson (Model.kt:103)
com.onesignal.user.internal.properties.PropertiesModel.createModelForProperty (PropertiesModel.kt:94)
com.onesignal.common.modeling.Model.initializeFromJson (Model.kt:86)
com.onesignal.common.modeling.SimpleModelStore.create (SimpleModelStore.kt:32)
com.onesignal.common.modeling.ModelStore.load (ModelStore.kt:129)
com.onesignal.common.modeling.SimpleModelStore.<init> (SimpleModelStore.kt:25)
com.onesignal.user.internal.properties.PropertiesModelStore.<init> (PropertiesModelStore.kt:8)
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:343)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:90)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:83)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.internal.OneSignalImp.initWithContext (OneSignalImp.kt:419)
com.onesignal.OneSignal.initWithContext (OneSignal.kt:126)

com.onesignal.core.internal.application.impl.ApplicationService.getAppContext (ApplicationService.kt:39)
com.onesignal.core.internal.preferences.impl.PreferencesService.getSharedPrefsByName (PreferencesService.kt:157)
com.onesignal.core.internal.preferences.impl.PreferencesService.get (PreferencesService.kt:62)
com.onesignal.core.internal.preferences.impl.PreferencesService.getString (PreferencesService.kt:36)
com.onesignal.common.modeling.ModelStore.load (ModelStore.kt:126)
com.onesignal.common.modeling.SimpleModelStore.<init> (SimpleModelStore.kt:25)
com.onesignal.core.internal.config.ConfigModelStore.<init> (ConfigModelStore.kt:8)
java.lang.reflect.Constructor.newInstance0 (Constructor.java)
java.lang.reflect.Constructor.newInstance (Constructor.java:343)
com.onesignal.common.services.ServiceRegistrationReflection.resolve (ServiceRegistration.kt:90)
com.onesignal.common.services.ServiceProvider.getServiceOrNull (ServiceProvider.kt:79)
com.onesignal.common.services.ServiceProvider.getService (ServiceProvider.kt:67)
com.onesignal.internal.OneSignalImp.initWithContext (OneSignalImp.kt:417)
com.onesignal.OneSignal.initWithContext (OneSignal.kt:126)

Code of Conduct

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

evgentset commented Oct 17, 2023

Observed similar issue on Redmi 5 Plus, Android 8.1.0, OneSignal Android SDK version 5+
My code is simple, just use init in onCreate method in Application class, like this:
OneSignal.initWithContext(this, appId)

Logs:

10-17 13:30:55.914 29034 29034 E AndroidRuntime: Process: com.*.*, PID: 29034
10-17 13:30:55.914 29034 29034 E AndroidRuntime: java.lang.RuntimeException: Unable to create application com.*.*.MyApplication: java.lang.reflect.InvocationTargetException
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5829)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.app.ActivityThread.-wrap1(Unknown Source:0)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1685)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:176)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6651)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at java.lang.reflect.Constructor.newInstance0(Native Method)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:90)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:83)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceRegistrationReflection.resolve(ServiceRegistration.kt:83)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceProvider.getServiceOrNull(ServiceProvider.kt:79)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.services.ServiceProvider.getService(ServiceProvider.kt:67)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.internal.OneSignalImp.initWithContext(OneSignalImp.kt:419)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.OneSignal.initWithContext(OneSignal.kt:126)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.*.*.MyApplication.onCreate(MyApplication.kt:25)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1120)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5826)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	... 8 more
10-17 13:30:55.914 29034 29034 E AndroidRuntime: Caused by: org.json.JSONException: Value test3 at key of type java.lang.String cannot be converted to boolean
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at org.json.JSON.typeMismatch(JSON.java:100)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at org.json.JSONObject.getBoolean(JSONObject.java:416)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.modeling.Model.initializeFromJson(Model.kt:107)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.user.internal.properties.PropertiesModel.createModelForProperty(PropertiesModel.kt:94)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.modeling.Model.initializeFromJson(Model.kt:87)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.modeling.SimpleModelStore.create(SimpleModelStore.kt:32)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.modeling.ModelStore.load(ModelStore.kt:129)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.common.modeling.SimpleModelStore.<init>(SimpleModelStore.kt:25)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	at com.onesignal.user.internal.properties.PropertiesModelStore.<init>(PropertiesModelStore.kt:8)
10-17 13:30:55.914 29034 29034 E AndroidRuntime: 	... 24 more

@emawby
Copy link
Contributor

emawby commented Oct 17, 2023

@IvanGarza07 Thank you for reaching out many of these issues have been resolved by releases since 5.0.0 although there may be still be existing issues. If you are able to reproduce any of these issues on the latest release any reproduction steps would be helpful

@IvanGarza07
Copy link
Author

@IvanGarza07 Thank you for reaching out many of these issues have been resolved by releases since 5.0.0 although there may be still be existing issues. If you are able to reproduce any of these issues on the latest release any reproduction steps would be helpful

i updated to latest version (5.0.3) but the errors persist, i try to reproduce the errors but can't reproduce the errors i dont have idea how to do that. I had to downgrade oneSignal to 4.8.3 version

@evgentset
Copy link

@emawby one more note, we're using Proguard/R8 in the app, maybe this related to the issue somehow. And the issue is reproducible not always, around 70% probably, sometimes it did not crashed the app.

@brismithers
Copy link
Contributor

brismithers commented Oct 30, 2023

I believe there are a couple distinct issues and want to make sure nothing is missed:

JSONException 'Value test3 at key..' and 'Value at lon...'
I believe we have a fix for this in #1884.

java.lang.Exception - Unrecognized operation: login-user-from-subscription*
This looks to have been fixed by #1845 and is in v5.0.2

java.lang.NullPointerException
I don't see a stack trace for this one. If you are still seeing this can you please provide more details and context around this one?

@brismithers brismithers self-assigned this Oct 30, 2023
@IvanGarza07
Copy link
Author

@brismithers yes there are a different issues and I guess these issues didn't fixed because I'm used the latest version and the problems still present in the app, I had to downgrade the 4.8.3 version. I cant give you more information cause I cant replicate the issues when run my app but in production the issue appear a lot.

@brismithers
Copy link
Contributor

No problem @IvanGarza07 and sorry for your headaches. Once we create a release containing the fix for #1884 I hope you are able to get give v5 another try! Regarding the last issue (the java.lang.NullPointerException) if it does happen again please post the stack trace. I'll close this issue once the next release is out.

@brismithers
Copy link
Contributor

Following up on this, #1884 was released in v5.0.4. Please create another issue if you see the NullPointerException again, thanks!

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

4 participants