This question is not similar to any of the others. I've already tried many solutions from App crashes with firebase phone auth, error while getting firebase phone auth OTP
Android app crashes on firebase phone authentication, but nothing works.
In my flutter app(android) I am using firebase phone authentication. When I call the 'verifyPhoneNumber' method of firebase to send OTP, my app getting crashes and exits leaving no error message.
Here's my code
final FirebaseAuth _auth = FirebaseAuth.instance;
Future sendOTP(String mobNo, BuildContext context, UserData _userData) async {
try {
_auth.verifyPhoneNumber(
phoneNumber: mobNo,
verificationCompleted: (val) {
print("verification completed val = $val");
},
verificationFailed: (val) {
print("verification failed val = $val");
},
codeSent: (String verificationId, [int forceResendingToken]) {
print("code sent to $mobNo");
Navigator.pushNamed(context, '/get_otp', arguments: {
'verificationId': verificationId,
'UserData': _userData,
});
},
codeAutoRetrievalTimeout: (val) {
print("code auto retrieval timeout val = $val");
});
} catch (e) {
print("auth error = $e");
}
}
I added my SHA-1, SHA-256 certificates in my firebase project, I tried changing versions of firebase_auth, fiebase_core. But, nothing works. I tried adding breakpoints in all the lines. The app exits when the reaches this line.
_auth.verifyPhoneNumber(
It is not proceeding further.
Please help me to solve this!!??
Here's my debug console log
E/AndroidRuntime(17712): java.lang.NoClassDefFoundError: Failed resolution of:
Landroidx/browser/customtabs/CustomTabsIntent$Builder;
E/AndroidRuntime(17712): at
com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-
auth@@20.0.2:13)
E/AndroidRuntime(17712): at com.google.android.gms.internal.firebase-auth-
api.zztw.zzb(com.google.firebase:firebase-auth@@20.0.2:7)
E/AndroidRuntime(17712): at com.google.android.gms.internal.firebase-auth-
api.zztw.onPostExecute(Unknown Source:2)
E/AndroidRuntime(17712): at android.os.AsyncTask.finish(AsyncTask.java:755)
E/AndroidRuntime(17712): at android.os.AsyncTask.access$900(AsyncTask.java:192)
E/AndroidRuntime(17712): at
android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
E/AndroidRuntime(17712): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(17712): at android.os.Looper.loop(Looper.java:228)
E/AndroidRuntime(17712): at
android.app.ActivityThread.main(ActivityThread.java:7826)
E/AndroidRuntime(17712): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17712): at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(17712): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981)
E/AndroidRuntime(17712): Caused by: java.lang.ClassNotFoundException: Didn't find
class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip
file "/data/app/com.creda.location_project-
1fyv3Q9ek4vLZKMcRkGyDQ==/base.apk"],nativeLibraryDirectories=
[/data/app/com.creda.location_project-1fyv3Q9ek4vLZKMcRkGyDQ==/lib/arm64,
/data/app/com.creda.location_project-1fyv3Q9ek4vLZKMcRkGyDQ==/base.apk!/lib/arm64-v8a,
/system/lib64, /system/product/lib64]]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…