microsoft / clarity-apps

Repo for distributing Clarity Apps packages
MIT License
46 stars 2 forks source link

Could not invoke Clarity.initialize (No static Method isInitialized) #13

Closed manuelTate closed 1 year ago

manuelTate commented 1 year ago

Hello.

Following the installation guide and documentation, I've been setting up clarity on a react-native application. Upon reaching the initialize function, the application crashes with the following error:

Screenshot_20230721-121107_eMove - Debug

This is a snippet of the faulty code:

import { initialize } from 'react-native-clarity'

...

if (IS_PRODUCTION && Platform.OS === 'android') initialize(CLARITY_PROD_ID, undefined, 'Verbose')

The application runs smoothly again by commenting said part of the code.

Is there something I'm missing on the Android setup part? I've tried to rebuild the application multiple times already. However, every time the same error shows up.

This is other data that may be key to the resolution of this bug:

There are sadly no runtime logs as the application crashes before being initialized. Thank you in advance.

maryamshal commented 1 year ago

Hello Manuel, Please use gradle to upgrade the androidx.work dependency to atleast 2.8.1. This should resolve your issue.

manuelTate commented 1 year ago

Yup, it worked like charm. Thank you! 🙌