question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] [expo-analytics-segment] ExponentSegment: Method addObserver must be called on the main thread

See original GitHub issue

Summary

Hello,

When I try to initialize Segment, I receive this error :

[Unhandled promise rejection: Error: Encountered an exception while calling native method: Exception occurred while executing exported method initialize on module ExponentSegment: Method addObserver must be called on the main thread]

This has been tested with Expo Go on Android device.

Cheers 😄

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

41.0.1

Environment

Expo CLI 4.5.2 environment info: System: OS: macOS 11.2.3 Shell: 5.8 - /bin/zsh Binaries: Node: 14.16.1 - /var/folders/k6/cqlnsz8x0756r83kbyb0s2700000gp/T/fnm-shell-5389680/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.12 - /var/folders/k6/cqlnsz8x0756r83kbyb0s2700000gp/T/fnm-shell-5389680/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /Users/colisweb/.rvm/gems/jruby-9.2.13.0/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 12.4/12D4e - /usr/bin/xcodebuild npmPackages: expo: ~41.0.1 => 41.0.1 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.5.2 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

Here is a minimalistic repo

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:33 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
mfdscommented, Jun 21, 2021

Hi! Any chances to get this working on Expo 41? I believe that it has been fixed here https://github.com/expo/expo/pull/13263

6reactions
doutatsucommented, Jun 18, 2021

Any updates on this? Observing the same issue on android, no Segment events are being registered as a result

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method addObserver must be called on the main thread
[Android] [expo-analytics-segment] ExponentSegment: Method addObserver must be called on the main thread.
Read more >
Method addObserver must be called on the main thread
I have access to all the files except android internal libraries. android · Share.
Read more >
[Android] Method addObserver must be called on the main ...
Got this error while trying to setup Purchases 3.4.3 in React Native. Method addObserver must be called on the main thread. Anyone faced...
Read more >
IllegalStateException: Method addObserver must be called on ...
I've updated two dependencies in my project: ... and now I see that NavController::navigate needs to be called from the main thread. Otherwise...
Read more >
Android SDK init on main thread - VMware Communities
has to be called on main thread or it will throw: java.lang.IllegalStateException: Method addObserver must be called on the main thread
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found