App crashes when updating the Phone Number in Firebase-Unity Auth

Nathalia Soragge

I am implementing a way to change the signed in phone number of the user. To do so, first I call PhoneAuthProvider.VerifyPhoneNumber to get a SMS with the code. Then I use the code to get the credential with PhoneAuthProvider.GetCredential. Everything works fine until this point. When I call FirebaseUser.UpdatePhoneNumberCredentialAsync to finally update the phone, the app crashes. The number is actually getting updated in Firebase, but the method crashes before it's finished. Am I doing something wrong or is it a Firebase-Unity bug? Follows the error log from Logcat.

(Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
07-06 21:01:03.776 2375-2412/? W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.android.gms.internal.zzdze@7af1ff3
07-06 21:01:05.597 2375-2536/? D/FirebaseAuth: Notifying id token listeners about user ( fVZUcEX80zWZIzD5xU8cIhSloVi1 ).
07-06 21:01:05.597 2375-2375/? D/FirebaseApp: Notifying auth state listeners.
07-06 21:01:05.598 2375-2375/? D/FirebaseApp: Notified 0 auth state listeners.
07-06 21:01:05.599 2375-2375/? E/firebase: result != nullptr
07-06 21:01:05.610 20205-30810/? W/FirebaseAuth: [PhoneNumberAuthPostProcessor] postProcess starts
07-06 21:01:05.693 2375-2375/? A/zygote: java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: can't call com.google.firebase.auth.FirebaseUser com.google.firebase.auth.AuthResult.getUser() on null object
    java_vm_ext.cc:504]     in call to CallObjectMethodV
    java_vm_ext.cc:504]     from void com.google.firebase.app.internal.cpp.JniResultCallback.nativeOnResult(java.lang.Object, boolean, int, java.lang.String, long, long)
    java_vm_ext.cc:504] "main" prio=5 tid=1 Runnable
    java_vm_ext.cc:504]   | group="main" sCount=0 dsCount=0 flags=0 obj=0x736004d8 self=0xe85f5000
    java_vm_ext.cc:504]   | sysTid=2375 nice=-10 cgrp=default sched=0/0 handle=0xecbba4bc
07-06 21:01:05.694 2375-2375/? A/zygote: java_vm_ext.cc:504]   | state=R schedstat=( 6746232415 788335286 4198 ) utm=547 stm=126 core=7 HZ=100
    java_vm_ext.cc:504]   | stack=0xff162000-0xff164000 stackSize=8MB
    java_vm_ext.cc:504]   | held mutexes= "mutator lock"(shared held)
    java_vm_ext.cc:504]   native: #00 pc 002c4a4b  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+130)
    java_vm_ext.cc:504]   native: #01 pc 003560a1  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+200)
    java_vm_ext.cc:504]   native: #02 pc 00352573  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+34)
    java_vm_ext.cc:504]   native: #03 pc 0022ff35  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+736)
    java_vm_ext.cc:504]   native: #04 pc 0023032b  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+58)
    java_vm_ext.cc:504]   native: #05 pc 000d280b  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+46)
    java_vm_ext.cc:504]   native: #06 pc 000d56a9  /system/lib/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+1228)
    java_vm_ext.cc:504]   native: #07 pc 000d4427  /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+514)
    java_vm_ext.cc:504]   native: #08 pc 000c548b  /system/lib/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+38)
    java_vm_ext.cc:504]   native: #09 pc 000b0513  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+18)
    java_vm_ext.cc:504]   native: #10 pc 000c5d6b  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4auth16ReadSignInResultEP8_jobjectPNS0_18FutureCallbackDataEbPv+46)
    java_vm_ext.cc:504]   native: #11 pc 000c5cad  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4auth14FutureCallbackEP7_JNIEnvP8_jobjectbiPKcPv+120)
    java_vm_ext.cc:504]   native: #12 pc 000cf0fd  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4util32JniResultCallback_nativeOnResultEP7_JNIEnvP8_jobjectS4_hiP8_jstringxx+116)
    java_vm_ext.cc:504]   native: #13 pc 000002c5  /data/data/com.company.product/cache/oat/arm/app_resources_lib.odex (Java_com_google_firebase_app_internal_cpp_JniResultCallback_nativeOnResult__Ljava_lang_Object_2ZILjava_lang_String_2JJ+164)
    java_vm_ext.cc:504]   at com.google.firebase.app.internal.cpp.JniResultCallback.nativeOnResult(Native method)
    java_vm_ext.cc:504]   at com.google.firebase.app.internal.cpp.JniResultCallback.onCompletion(JniResultCallback.java:196)
    java_vm_ext.cc:504]   - locked <0x071a32e1> (a com.google.firebase.app.internal.cpp.JniResultCallback)
    java_vm_ext.cc:504]   at com.google.firebase.app.internal.cpp.JniResultCallback$TaskCallback.onSuccess(JniResultCallback.java:106)
    java_vm_ext.cc:504]   - locked <0x0cae6806> (a java.lang.Object)
    java_vm_ext.cc:504]   at com.google.android.gms.tasks.zzj.run(unavailable:-1)
    java_vm_ext.cc:504]   - locked <0x04984ec7> (a java.lang.Object)
    java_vm_ext.cc:504]   at android.os.Handler.handleCallback(Handler.java:789)
    java_vm_ext.cc:504]   at android.os.Handler.dispatchMessage(Handler.java:98)
    java_vm_ext.cc:504]   at android.os.Looper.loop(Looper.java:164)
    java_vm_ext.cc:504]   at android.app.ActivityThread.main(ActivityThread.java:6938)
    java_vm_ext.cc:504]   at java.lang.reflect.Method.invoke(Native method)
    java_vm_ext.cc:504]   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    java_vm_ext.cc:504]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
    java_vm_ext.cc:504] 
    runtime.cc:516] Runtime aborting...
    runtime.cc:516] 
    runtime.cc:524] JNI DETECTED ERROR IN APPLICATION: can't call com.google.firebase.auth.FirebaseUser com.google.firebase.auth.AuthResult.getUser() on null object
    runtime.cc:524]     in call to CallObjectMethodV
    runtime.cc:524]     from void com.google.firebase.app.internal.cpp.JniResultCallback.nativeOnResult(java.lang.Object, boolean, int, java.lang.String, long, long)
    runtime.cc:524] "main" prio=5 tid=1 Runnable
    runtime.cc:524]   | group="main" sCount=0 dsCount=0 flags=0 obj=0x736004d8 self=0xe85f5000
    runtime.cc:524]   | sysTid=2375 nice=-10 cgrp=default sched=0/0 handle=0xecbba4bc
    runtime.cc:524]   | state=R schedstat=( 6746232415 788335286 4198 ) utm=547 stm=126 core=7 HZ=100
    runtime.cc:524]   | stack=0xff162000-0xff164000 stackSize=8MB
    runtime.cc:524]   | held mutexes= "mutator lock"(shared held)
    runtime.cc:524]   native: #00 pc 002c4a4b  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+130)
    runtime.cc:524]   native: #01 pc 003560a1  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+200)
    runtime.cc:524]   native: #02 pc 00352573  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+34)
    runtime.cc:524]   native: #03 pc 0022ff35  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+736)
    runtime.cc:524]   native: #04 pc 0023032b  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+58)
    runtime.cc:524]   native: #05 pc 000d280b  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+46)
    runtime.cc:524]   native: #06 pc 000d56a9  /system/lib/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+1228)
    runtime.cc:524]   native: #07 pc 000d4427  /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+514)
    runtime.cc:524]   native: #08 pc 000c548b  /system/lib/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+38)
    runtime.cc:524]   native: #09 pc 000b0513  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+18)
    runtime.cc:524]   native: #10 pc 000c5d6b  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4auth16ReadSignInResultEP8_jobjectPNS0_18FutureCallbackDataEbPv+46)
    runtime.cc:524]   native: #11 pc 000c5cad  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4auth14FutureCallbackEP7_JNIEnvP8_jobjectbiPKcPv+120)
07-06 21:01:05.695 2375-2375/? A/zygote: runtime.cc:524]   native: #12 pc 000cf0fd  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4util32JniResultCallback_nativeOnResultEP7_JNIEnvP8_jobjectS4_hiP8_jstringxx+116)
    runtime.cc:524]   native: #13 pc 000002c5  /data/data/com.company.product/cache/oat/arm/app_resources_lib.odex (Java_com_google_firebase_app_internal_cpp_JniResultCallback_nativeOnResult__Ljava_lang_Object_2ZILjava_lang_String_2JJ+164)
    runtime.cc:524]   at com.google.firebase.app.internal.cpp.JniResultCallback.nativeOnResult(Native method)
    runtime.cc:524]   at com.google.firebase.app.internal.cpp.JniResultCallback.onCompletion(JniResultCallback.java:196)
    runtime.cc:524]   - locked <0x071a32e1> (a com.google.firebase.app.internal.cpp.JniResultCallback)
    runtime.cc:524]   at com.google.firebase.app.internal.cpp.JniResultCallback$TaskCallback.onSuccess(JniResultCallback.java:106)
    runtime.cc:524]   - locked <0x0cae6806> (a java.lang.Object)
    runtime.cc:524]   at com.google.android.gms.tasks.zzj.run(unavailable:-1)
    runtime.cc:524]   - locked <0x04984ec7> (a java.lang.Object)
    runtime.cc:524]   at android.os.Handler.handleCallback(Handler.java:789)
    runtime.cc:524]   at android.os.Handler.dispatchMessage(Handler.java:98)
    runtime.cc:524]   at android.os.Looper.loop(Looper.java:164)
    runtime.cc:524]   at android.app.ActivityThread.main(ActivityThread.java:6938)
    runtime.cc:524]   at java.lang.reflect.Method.invoke(Native method)
    runtime.cc:524]   at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    runtime.cc:524]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
    runtime.cc:524] 
07-06 21:01:05.846 2563-2563/? A/DEBUG: Abort message: 'java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: can't call com.google.firebase.auth.FirebaseUser com.google.firebase.auth.AuthResult.getUser() on null object'
        r0 00000000  r1 00000947  r2 00000006  r3 00000008
        r4 00000947  r5 00000947  r6 ff95d790  r7 0000010c
        r8 0000000b  r9 ff95d7f1  sl 0000000a  fp ff95d7f0
        ip 00000000  sp ff95d780  lr e9f6e447  pc e9f9f508  cpsr 200d0010
07-06 21:01:05.856 2563-2563/? A/DEBUG:     #04 pc 003ef7ad  /system/lib/libart.so (_ZN7android4base10LogMessageD1Ev+456)
        #05 pc 00230143  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1262)
        #06 pc 0023032b  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+58)
        #07 pc 000d280b  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+46)
        #08 pc 000d56a9  /system/lib/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+1228)
        #09 pc 000d4427  /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+514)
        #10 pc 000c548b  /system/lib/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+38)
        #11 pc 000b0513  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+18)
        #12 pc 000c5d6b  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4auth16ReadSignInResultEP8_jobjectPNS0_18FutureCallbackDataEbPv+46)
        #13 pc 000c5cad  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4auth14FutureCallbackEP7_JNIEnvP8_jobjectbiPKcPv+120)
        #14 pc 000cf0fd  /data/app/com.company.product-muqASgSszT-5GC-bGDgKRQ==/lib/arm/libApp-4.5.2.so (_ZN8firebase4util32JniResultCallback_nativeOnResultEP7_JNIEnvP8_jobjectS4_hiP8_jstringxx+116)
        #15 pc 000002c5  /data/data/com.company.product/cache/oat/arm/app_resources_lib.odex (offset 0x2000)
07-06 21:01:17.397 20205-21357/? E/FirebaseAuth: [VerifyPhoneNumberOperation] RemoteException when sending auto retrieval timeout response.
    android.os.DeadObjectException
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(Binder.java:761)
        at car.c(:com.google.android.gms@[email protected] (040408-197041431):1)
        at bebh.c(:com.google.android.gms@[email protected] (040408-197041431):2)
        at bdyf.a(:com.google.android.gms@[email protected] (040408-197041431):4)
        at bdyd.a(:com.google.android.gms@[email protected] (040408-197041431):1)
        at bdyd.c(:com.google.android.gms@[email protected] (040408-197041431):1)
        at bdyd.handleMessage(:com.google.android.gms@[email protected] (040408-197041431):52)
        at oup.run(:com.google.android.gms@[email protected] (040408-197041431):5)
        at ovb.run(:com.google.android.gms@[email protected] (040408-197041431):27)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at pbc.run(Unknown Source:7)
        at java.lang.Thread.run(Thread.java:764)
07-06 21:01:17.398 20205-21357/? W/FirebaseAuth: [PhoneVerificationSession] PhoneVerificationSession terminated
07-06 21:01:17.420 20205-28403/? W/FirebaseAuth: [PhoneNumberAuthPostProcessor] postProcess ends
07-06 21:01:17.433 20205-30810/? W/FirebaseAuth: [PhoneNumberAuthPostProcessor] postProcess ends

And the method I'm using:

public void UpdatePhoneNumber(string smsCode, Action<string> OnUpdatePhoneFinish)
{
    Debug.Log("CODE: " + smsCode);

    if (m_signupData != null)
    {
        m_signupData.Credetial = PhoneAuthProvider.GetInstance(m_firebaseAuth).GetCredential(m_signupData.Id, smsCode); 

        Debug.Log("CREDENTIAL: " + m_signupData.Credetial); // working fine until this point

        m_firebaseUser.UpdatePhoneNumberCredentialAsync(m_signupData.Credetial).ContinueWith((task) =>
        {
            Debug.Log("Finished request"); // never reaches this debug
        });
    }
}

Everything works fine until I call UpdatePhoneNumberCredentialAsync. The Debug inside the callback is never reached.

Nathalia Soragge

Looks like this was a Firebase-Unity bug, fixed in version 5.2.0:

Bug-fix release-note

https://firebase.google.com/support/release-notes/unity

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to I get the user phone number after verification in react using firebase phone auth

Login app with existing user - phone Auth Firebase Android -

Flutter app crashes on firebase phone auth in iOS platform

App Store rejection due to Firebase phone auth

Firebase Auth using phone number returns an internal error

iOS app crashes when authenticating with Firebase

Firebase phone Auth for Android , Can we just verify phone number without creating a user account

Firebase Phone Auth and Phone number Selector

Firebase Auth using phone number and password

Android app crashes when adding firebase crashlytics

Swift app crashes when uploading image to firebase

Firebase Auth: Get users by email or phone number

Firebase Phone Auth on Android

Unity app crashes on iOS14 when transitioning to a specific scene

Firebase Auth - Unable to Add Phone Number for Testing

firebase auth with phone number

What happens to the data when updating the app in windows phone 8

Android App Crashes When Getting the IMEI Number

App crashes and restarts phone

Unity - Zelda life system crashes when updating the hp containers

Android app crashes on firebase phone authentication

Verify if a phone number exist in firebase app using firebase cloud function

Unity App Crashes When Sign-In via Play Games is Attempted

App Crashes After Verifying OTP Using Firebase Phone Auth

Firebase App Crashes when minifyEnabled is true

Firebase Auth Login and Signup app crashes when button clicked

firebase phone auth for browser

App crashes when sending image to Firebase storage

crashes app when I log in using facebook auth