Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Exception: java.lang.IllegalStateException #16

Closed
turker0 opened this issue Apr 7, 2022 · 2 comments
Closed

Fatal Exception: java.lang.IllegalStateException #16

turker0 opened this issue Apr 7, 2022 · 2 comments

Comments

@turker0
Copy link

turker0 commented Apr 7, 2022

Hi, having this issue after deploying the app to store.
Working well on local devices.
Any thoughts or suggestions?

Firebase Crashlytics

ReactNativeSmsUserConsentModule.java line 44

SmsRetriever.getClient(getCurrentActivity()).startSmsUserConsent(null);

image

Fatal Exception: java.lang.IllegalStateException: Method addObserver must be called on the main thread at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317) at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:172) at androidx.fragment.app.Fragment.initLifecycle(Fragment.java:496) at androidx.fragment.app.Fragment.<init>(Fragment.java:476) at com.google.android.gms.common.api.internal.zzc.<init>(com.google.android.gms:play-services-basement@@17.2.1:1) at com.google.android.gms.common.api.internal.zzc.zza(com.google.android.gms:play-services-basement@@17.2.1:14) at com.google.android.gms.common.api.internal.LifecycleCallback.getFragment(com.google.android.gms:play-services-basement@@17.2.1:3) at com.google.android.gms.common.api.internal.LifecycleCallback.getFragment(com.google.android.gms:play-services-basement@@17.2.1:7) at com.google.android.gms.common.api.internal.zaac.zaa(com.google.android.gms:play-services-base@@17.2.1:1) at com.google.android.gms.common.api.GoogleApi.<init>(com.google.android.gms:play-services-base@@17.2.1:33) at com.google.android.gms.auth.api.phone.SmsRetrieverClient.<init>(com.google.android.gms:play-services-auth-api-phone@@17.4.0:3) at com.google.android.gms.internal.auth-api-phone.zzu.<init>(com.google.android.gms:play-services-auth-api-phone@@17.4.0:3) at com.google.android.gms.auth.api.phone.SmsRetriever.getClient(com.google.android.gms:play-services-auth-api-phone@@17.4.0:2) at com.akvelon.reactnativesmsuserconsent.ReactNativeSmsUserConsentModule.subscribe(ReactNativeSmsUserConsentModule.java:44) at com.akvelon.reactnativesmsuserconsent.ReactNativeSmsUserConsentModule.startNativeSmsListener(ReactNativeSmsUserConsentModule.java:124) at java.lang.reflect.Method.invoke(Method.java) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:246) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226) at java.lang.Thread.run(Thread.java:923)

Basically using package like this

import {useSmsUserConsent} from '@eabdullazyanov/react-native-sms-user-consent'
...
const androidOTP = useSmsUserConsent()
...
useEffect(() => {
if (androidOTP) {
setCode(androidOTP)
}
}, [androidOTP])

@SuyunSarbayev
Copy link

@oguzturker8 Hi is this still an issue? Can't reproduce on my side

@turker0
Copy link
Author

turker0 commented Aug 26, 2022

Ater the upgrading react native 0.63 to 0.66 its solved

@turker0 turker0 closed this as completed Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants