gpt4 book ai didi

android - Firebase 电话验证 verifyPhoneNumber() 已弃用 + 应用程序崩溃

转载 作者:行者123 更新时间:2023-12-04 23:36:14 26 4
gpt4 key购买 nike

升级后出现错误 Firebase 身份验证 (20.0.0) 电话身份验证的依赖项, PhoneAuthProvider.getInstance().verifyPhoneNumber()
依赖:

implementation 'com.google.firebase:firebase-auth:20.0.0'
错误:
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.0:92)
at com.google.firebase.auth.api.internal.zzeq.zza(com.google.firebase:firebase-auth@@20.0.0:79)
at com.google.firebase.auth.api.internal.zzeq.onPostExecute(com.google.firebase:firebase-auth@@20.0.0:88)
at android.os.AsyncTask.finish(AsyncTask.java:755)
at android.os.AsyncTask.access$900(AsyncTask.java:192)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7948)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder"
谁能解释我应该为新的依赖项改变什么?有哪些新步骤?

最佳答案

这是我为删除错误所做的:
我提到了firebase phone auth documentation并进行了必要的更改:
替换这个:

PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber, //phone number to be verified
60, // validity of the OTP
TimeUnit.SECONDS,
(Activity) TaskExecutors.MAIN_THREAD,
mCallBack // onVerificationStateChangedCallback
);
有了这个
PhoneAuthOptions options =
PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber(phoneNumber) // Phone number to verify
.setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
.setActivity(this) // Activity (for callback binding)
.setCallbacks(mCallBack) // OnVerificationStateChangedCallbacks
.build();
PhoneAuthProvider.verifyPhoneNumber(options);
此外,将其添加到您的 app/gradle 文件依赖项中:
implementation 'androidx.browser:browser:1.2.0'
这将有助于 firebase 打开浏览器进行 reCAPTCHA 验证。
希望这有效!

关于android - Firebase 电话验证 verifyPhoneNumber() 已弃用 + 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64608484/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com