Solved

Fatal Exception: org.json.JSONException occured

  • 18 June 2023
  • 8 replies
  • 150 views

Badge +2

Thank you for creating a crazy useful package.

I use this android library com.revenuecat.purchases:purchases:6.4.0.

Unexpected crash in some users.

The error log is here.

Fatal Exception: org.json.JSONException: Value  of type java.lang.String cannot be converted to JSONObject
       at org.json.JSON.typeMismatch(JSON.java:112)
       at org.json.JSONObject.<init>(JSONObject.java:172)
       at org.json.JSONObject.<init>(JSONObject.java:185)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsFileHelper.readDiagnosticsFile(DiagnosticsFileHelper.kt:39)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer.getEventsToSync(DiagnosticsSynchronizer.kt:86)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer.access$getEventsToSync(DiagnosticsSynchronizer.kt:19)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer$syncDiagnosticsFileIfNeeded$1.invoke(DiagnosticsSynchronizer.kt:44)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer$syncDiagnosticsFileIfNeeded$1.invoke(DiagnosticsSynchronizer.kt:42)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer.enqueue$lambda-0(DiagnosticsSynchronizer.kt:98)
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer.$r8$lambda$mqITcCXi0Ieo366GSfaHWPssYh4()
       at com.revenuecat.purchases.common.diagnostics.DiagnosticsSynchronizer$$ExternalSyntheticLambda0.run(:2)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
       at java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
       at com.revenuecat.purchases.PurchasesFactory$LowPriorityThreadFactory.newThread$lambda-1(PurchasesFactory.kt:240)
       at com.revenuecat.purchases.PurchasesFactory$LowPriorityThreadFactory.$r8$lambda$gealA1lBCYgMQlWu9n99TSUZEMU()
       at com.revenuecat.purchases.PurchasesFactory$LowPriorityThreadFactory$$ExternalSyntheticLambda0.run(:2)
       at java.lang.Thread.run(Thread.java:1012)

 

I cant solve this problem.

Please help me to solve.

icon

Best answer by toni-rico 23 June 2023, 14:27

View original

8 replies

Userlevel 2
Badge +3

Hey there @bowyer  👋 thanks for posting! I’m Toni, from the RC team.

Seems that you’re using diagnostics. Do you know if this crash happens in specific Android versions? We are working on a fix in the meantime and that info would help us a lot.

Thanks!

Userlevel 2
Badge +3

Also, are you able to repro this issue yourself @bowyer? Any other information you can provide would be helpful.

Badge +2

Hey @toni-rico  thanks for reply.

 

Do you know if this crash happens in specific Android versions?

Maybe this crash is device specific.

This issue occurs only Xperia Ace III(Android12)and Pixel 3a(Android12).

Also, are you able to repro this issue yourself

I have Pixel 3a(Android12) but i can't able to repro this issue my device.

This issue occurs customer devices only. 

best regards.

Badge +2

 

This is my Crashlytics report.

According to the report, there is no problem with the condition of the device. No evidence of modification such as root.

The device have sufficient memory and ram space.

If anything is noteworthy, it occurs only with two users.

 

Userlevel 2
Badge +3

Thanks for the information @bowyer! We just released version 6.5.1 of the Android SDK that should fix the crashes you’re experiencing. Could you try it and let us know?

Badge +2

@toni-rico 

Thank you. I’ll try it.

Could you try it and let us know?

Of course.
I'm releasing it today, so give me a few days.

Badge +2

@toni-rico 

 

After applying the latest SDK 6.5.1, the crashes seem to be gone.
Thank you very much.

Userlevel 2
Badge +3

Glad that it worked, thanks for letting us know!

Reply