Skip to main content
Solved

Fatal Exception: org.json.JSONException occured

  • Jun 18, 2023 2:05 AM UTC
  • 8 replies
  • 639 views

Forum|alt.badge.img+4

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.

Best answer by toni-rico

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?

View original
This post has been closed for comments

8 replies

Forum|alt.badge.img+3
  • RevenueCat Staff
  • Jun 20, 2023 10:01 AM UTC

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!


Forum|alt.badge.img+3
  • RevenueCat Staff
  • Jun 21, 2023 8:45 AM UTC

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


Forum|alt.badge.img+4
  • Author
  • New Member
  • Jun 21, 2023 10:27 AM UTC

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.


Forum|alt.badge.img+4
  • Author
  • New Member
  • Jun 21, 2023 10:33 AM UTC

 

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.

 


Forum|alt.badge.img+3
  • RevenueCat Staff
  • Answer
  • Jun 23, 2023 12:27 PM UTC

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?


Forum|alt.badge.img+4
  • Author
  • New Member
  • Jun 23, 2023 12:46 PM UTC

@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.


Forum|alt.badge.img+4
  • Author
  • New Member
  • Jun 26, 2023 12:13 PM UTC

@toni-rico 

 

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


Forum|alt.badge.img+3
  • RevenueCat Staff
  • Jun 26, 2023 12:25 PM UTC

Glad that it worked, thanks for letting us know!