6.5.0 DropInClient - Method addObserver must be called on the main thread
See original GitHub issueI am working on react native module for DropIn and getting this error on initialization of DropInClient
implementation "com.braintreepayments.api:drop-in:6.5.0
val dropInClient = DropInClient(currentActivity as AppCompatActivity?,clientToken)
Method addObserver must be called on the main thread
Why this error can appear?
Issue Analytics
- State:
- Created 9 months ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Android Navigation Instrumentation test throws Method ...
IllegalStateException : Method addObserver must be called on the main thread. My environment: fragment_version = 1.2.5 nav_version = 2.3.1 ...
Read more >Method addObserver must be called on the main thread #772
Hello, I have an issue when trying to import dji sdk to android app. Registering app crashes the app because of this error...
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] 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 >Android SDK init on main thread
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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wayson I found a solution. You can init the drop in client with an empty token in onCreate() of Activity with shared instance and then use it inside the module by providing token and calling invalidateClientToken which will trigger fetch client token callback.
Activity onCreate():
@sshropshire Thanks for your reply. I’ve tried that but DropInClient can only be called in onCreate() on Activity. Otherwise we will have error of
Method addObserver must be called on the main thread
.I’ve also tried
But the app just crash straight away after this call.