-
-
Notifications
You must be signed in to change notification settings - Fork 32
Method addObserver must be called on the main thread #520
Comments
Hmm this error is coming from the Android SDK, can you please indicate the SDK version and React Native version that you're using? Thanks. |
@jennmueng, thanks for the quick response!
|
Ok so the React Native SDK @ |
Thanks. Is there anything else I can do to help with debugging? |
I have the same issue with react-native
|
hey thanks for reporting this, quick question: are you initing the Android SDK manually by yourself or are you letting the Sentry RN SDK do the job automatically? If you are letting the Sentry RN SDK do the job, on which life cycle (which class/method) of the RN App. are ou initing the Sentry RN SDK? thanks :) |
@lewisf @zumaawad what version of the |
as you can see, this has been changed in the lib and ideally, we'd add a main thread checker to avoid this problem. 1st commit: https://android.googlesource.com/platform/frameworks/support/+/1a587cf583809379add635a9047ded82d44306c8 |
as a workaround, you can disable the lifecycle breadcrumbs for now: https://docs.sentry.io/platforms/android/#default-context-for-android
|
@marandaneto I'm using RN SDK and I initiate in app.js |
@marandaneto Still the same
|
ups sorry, you also have to disable the session tracking as it depends on this 3rd party lib. https://docs.sentry.io/platforms/react-native/#release-health so if |
@marandaneto Its working now with |
@zumaawad good to know, mind answering the other question so we could choose the best solution? life cycle in the app.js file etc, thanks. |
I tried Sentry.init() in App.js and in index.android.js. Nothing helps. How about: |
@marandaneto In componentDidMount |
@zumaawad have you tried right before the App ReactNode? eg:
|
@marandaneto I tired that too and didn’t work without workaround you mentioned before |
@zumaawad ok, I will check if something has changed in the way how RN inits, we already have a PR to fix the issue anyway, getting feedback and will release a patch soon, thanks. |
@marandaneto I think your PR #525 will fix this |
@zumaawad indeed, but I wanna find out the source of this issue, as we've not changed anything on this repo about that, its either a change on sentry-react-native, on RN itself or you all have a transitive dependency of androidx.lifecycle/lifecycle-process that uses the main thread requirement, the latest is the most probably. |
@marandaneto The fun fact is: we didn’t change anything from our side too 😄 |
the Android SDK is published https://github.com/getsentry/sentry-android/releases/tag/2.3.1 you could upgrade this dependency in your path to upgrade the Android SDK: something like: If you have applied the workarounds mentioned before, remember to revert it, so you don't lose the session tracking feature nor the app lifecycle breadcrumbs :) |
RN SDK is also published https://github.com/getsentry/sentry-react-native/releases/tag/1.7.2 |
@marandaneto Thank you |
@marandaneto thanks!! appreciate the quick turnaround on this |
Platform:
SDK:
@sentry/react-native
(>= 1.0.0)react-native-sentry
(<= 0.43.2)RN SDK version: 1.6.3
Android SDK version: 2.2.0
react-native
version: 0.62.17Are you using Expo?
Are you using sentry.io or on-premise?
If you are using sentry.io, please post a link to your issue so we can take a look:
https://sentry.io/organizations/persona-identities-inc/issues/1839866967/?project=5378601&query=is%3Aunresolved
Configuration:
(
@sentry/react-native
)I have following issue:
I went through barebones setup steps and am getting this error. Commenting out the
Sentry.init
gets rid of it. Stack trace seems to indicate it's all happening within the Sentry library but I'm not sure if I'm doing something wrong.Steps to reproduce:
Actual result:
Expected result:
No error.
The text was updated successfully, but these errors were encountered: