microsoft / clarity

A behavioral analytics library that uses dom mutations and user interactions to generate aggregated insights.
https://clarity.microsoft.com
MIT License
2.09k stars 208 forks source link

bare react-native app crashes on startup on devices with android 6 and below #485

Closed supmanyu closed 9 months ago

supmanyu commented 11 months ago

We've been getting crash report on crashlytics since integrating clarity, they are only happening for devices running android 6 and below (API level 22 and below), the error log is below:

Fatal Exception: io.reactivex.exceptions.UndeliverableException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/microsoft/clarity/sf/b;
       at com.microsoft.clarity.yo.a.q(RxJavaPlugins.java:4)
       at com.microsoft.clarity.uo.h.run(ScheduledRunnable.java:3)
       at com.microsoft.clarity.uo.h.call(ScheduledRunnable.java:1)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

My question is whether there is a way to prevent bundling the native clarity package on certain android versions (either through some gradle configuration or native library) or can this issue be resolved at the package level itself? for now we are preventing users on android 6.x and below from installing the app itself.

ibradwan commented 11 months ago

Hi @supmanyu, Sorry for the inconvenience that this may have caused you. Currently, Clarity does not start if the device API level is less than 29. I tried again on an emulator that is running on API 22 and could not repro the issue. Could you please let us know:

supmanyu commented 11 months ago

Hi @ibradwan, thanks for the reply, requested versions are as below

ibradwan commented 10 months ago

We tried to repro this issue by creating a new project with the mentioned React Native version, then tried to integrate the Clarity package 1.0.1 and everything worked as expected (a log got printed that says Clarity won't start due to an unsupported API level) an no crashes were observed. Could you please provide concrete steps on how to repro this issue consistently? Starting from creating a new project all the way up to integrating Clarity and then facing the crash. Thanks a lot!