I have Email Password Authentification on Sign in Page of my Application. In Edit Profile Section, I wanted to give User an option to update their Phone Number, and for that, I am using FirebaseAuth.instance.verifyPhone(), but as the execution comes on that line, the Application just get shut down giving a bunch of Errors in Debug Console. Those as as follows:
E/zzf ( 7816): Problem retrieving SafetyNet Token: 7: I/zzjy ( 7816): Provider GmsCore_OpenSSL not available W/System ( 7816): Ignoring header X-Firebase-Locale because its value was null. D/AndroidRuntime( 7816): Shutting down VM E/AndroidRuntime( 7816): FATAL EXCEPTION: main E/AndroidRuntime( 7816): Process: com.example.e_commerce_app_flutter, PID: 7816 E/AndroidRuntime( 7816): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder; E/AndroidRuntime( 7816): at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.1:13) E/AndroidRuntime( 7816): at com.google.android.gms.internal.firebase-auth-api.zzth.zzb(com.google.firebase:firebase-auth@@20.0.1:7) E/AndroidRuntime( 7816): at com.google.android.gms.internal.firebase-auth-api.zzth.onPostExecute(Unknown Source:2) E/AndroidRuntime( 7816): at android.os.AsyncTask.finish(AsyncTask.java:771) E/AndroidRuntime( 7816): at android.os.AsyncTask.access$900(AsyncTask.java:199) E/AndroidRuntime( 7816): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788) E/AndroidRuntime( 7816): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime( 7816): at android.os.Looper.loop(Looper.java:223) E/AndroidRuntime( 7816): at android.app.ActivityThread.main(ActivityThread.java:7656) E/AndroidRuntime( 7816): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 7816): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/AndroidRuntime( 7816): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/AndroidRuntime( 7816): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/~~FEdP9tQWDC6NWC3shwRRfw==/com.example.e_commerce_app_flutter-ZXUHhzr6Jw4GssFBNZlMtg==/base.apk"],nativeLibraryDirectories=[/data/app/~~FEdP9tQWDC6NWC3shwRRfw==/com.example.e_commerce_app_flutter-ZXUHhzr6Jw4GssFBNZlMtg==/lib/x86, /data/app/~~FEdP9tQWDC6NWC3shwRRfw==/com.example.e_commerce_app_flutter-ZXUHhzr6Jw4GssFBNZlMtg==/base.apk!/lib/x86, /system/lib, /system_ext/lib]] E/AndroidRuntime( 7816): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) E/AndroidRuntime( 7816): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime( 7816): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime( 7816): ... 12 more I/Process ( 7816): Sending signal. PID: 7816 SIG: 9 Lost connection to device.
The corresponding code for updating phone number is:
// TODO: fix implementation update phone service final authService = AuthentificationService().firebaseAuth; print( "Update Phone request for ${authService.currentUser.email} ..."); try { print("Calling verifyPhoneNumber()"); final verificationCompleteCallback = (credential) async { print("Inside verificationCompleted()"); }; final verificationFailedCallback = (exception) { print("Inside verificationFailed()"); if (exception.code == 'invalid-phone-number') { print('The provided phone number is not valid.'); } else { print( "Exception received in verificationFailed: ${exception.code}"); } }; final codeSentCallback = (verificationId, resendToken) async { print( "Inside codeSent() -> verificationId: $verificationId"); PhoneAuthCredential phoneAuthCredential = PhoneAuthProvider.credential( verificationId: verificationId, smsCode: "666666", ); await authService.currentUser .updatePhoneNumber(phoneAuthCredential); }; final codeAutoRetrivalTimeoutCallback = (verificationId) { print( "Inside codeAutoRetrievalTimeout() -> verificationId: $verificationId"); }; authService.verifyPhoneNumber( phoneNumber: fieldController.text, verificationCompleted: verificationCompleteCallback, verificationFailed: verificationFailedCallback, codeSent: codeSentCallback, codeAutoRetrievalTimeout: codeAutoRetrivalTimeoutCallback, ); } catch (e) { print("Exception: $e"); }
Corresponding Code File: https://github.com/imRB7here/e_commerce_app_flutter/blob/master/lib/screens/change_phone/components/body.dart