microsoft / clarity

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

Jetpack Compose Support #628

Closed BcanGRG closed 4 months ago

BcanGRG commented 5 months ago

Hello clarity team,

We want to use Clarity in our Android application, but our application has pages written with Jetpack Compose and cannot work with Clarity in harmony with these pages.

When will Jetpack compose support come?

aligkts commented 4 months ago

Even I put *Screen exclusion for masking, it doesn't support. ++

ibradwan commented 4 months ago

We've just released our first compose package (clarity-compose) :) Please give it a shot and let us know your feedback.

BcanGRG commented 4 months ago

Is there a need for an extra implementation? Is it enough if we just update the current implementation to the latest version? @ibradwan

ibradwan commented 4 months ago

All what you have to do is to switch to the "clarity-compose" package and you should start seeing compose views in playback. The docs will be updates soon to include more details.

nikhilbiju67 commented 4 months ago

@ibradwan Hey i am using the package "com.microsoft.clarity:clarity-compose:2.5.0" but still compose views are not shown in dashboard

SaadeldinBadr commented 4 months ago

Hello @nikhilbiju67, which version of Jetpack Compose are you using?

nikhilbiju67 commented 4 months ago

I am using implementation(platform("androidx.compose:compose-bom:2024.06.00")) @SaadeldinBadr

SaadeldinBadr commented 4 months ago

@nikhilbiju67 Could you please set log level in Clarity config to LogLevel.Verbose and share the logs with tag:Clarity here for a brief session? Also provide me with your app's package name if possible.

Wysel commented 2 months ago

Hello there, I just started playing with Microsoft Clarity. I have integrated Clarity into my project, which is mostly Jetpack Compose with few legacy view based screens. Clarity version: com.microsoft.clarity:clarity-compose:2.5.1 Non-composable activities appears to be captured correctly, but all composable screens are blank. Here's an exception that I get:

[SourceFile::a] Exception in captureAndroidComposeView: java.lang.NullPointerException 2024-09-30 10:38:53.102 1185-1185 Clarity aaa.bbb.cccc.ddddddddddd E [SourceFile::a] null 2024-09-30 10:38:53.102 1185-1185 Clarity aaa.bbb.cccc.ddddddddddd E [SourceFile::a] java.lang.NullPointerException (Ask Gemini) at com.microsoft.clarity.e.b.a(Unknown Source:32) at com.microsoft.clarity.e.b.a(SourceFile:6) at com.microsoft.clarity.e.d.a(SourceFile:84) at com.microsoft.clarity.e.d.a(SourceFile:84) at com.microsoft.clarity.e.d.a(SourceFile:84) at com.microsoft.clarity.e.d.a(SourceFile:84) at com.microsoft.clarity.e.d.a(SourceFile:84) at com.microsoft.clarity.e.d$d.invoke(SourceFile:3) at com.microsoft.clarity.e.d.a(SourceFile:20) at com.microsoft.clarity.f.j.invoke(SourceFile:3) at com.microsoft.clarity.n.k.a(Unknown Source:22) at com.microsoft.clarity.f.k$a.invoke(SourceFile:12) at com.microsoft.clarity.n.d.a(Unknown Source:5) at com.microsoft.clarity.n.c.invoke(SourceFile:1) at com.microsoft.clarity.n.k.a(Unknown Source:22) at com.microsoft.clarity.n.d.a(SourceFile:5) at com.microsoft.clarity.f.k.run(SourceFile:2) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:230) at android.os.Looper.loop(Looper.java:319) at android.app.ActivityThread.main(ActivityThread.java:9063) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

compile sdk: 34 target sdk: 34 device running Android 14

Thank you for your help.

SaadeldinBadr commented 2 months ago

Hello @Wysel , which version of Jetpack Compose are you using?

Wysel commented 2 months ago

1.7.2

SaadeldinBadr commented 2 months ago

@Wysel, this version is not supported yet. Currently clarity-compose:2.5.x supports jetpack compose stable releases from 1.0.0 to 1.6.8.

Supported Jetpack Compose Versions

Wysel commented 2 months ago

Thanks @SaadeldinBadr, I was afraid that that's what's happening :) When do you expect to provide support for 1.7.2?