gpt4 book ai didi

android - 如何修复由 : java. 引起的 lang.ClassNotFoundException:找不到类 "androidx.browser.customtabs.CustomTabsIntent$Builder"

转载 作者:行者123 更新时间:2023-12-04 13:30:28 26 4
gpt4 key购买 nike

我正在尝试使用 firebase 通过电话号码实现 OTP 验证,但出现错误:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.wasali.mobile_authentication, PID: 7864
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.1:13)
at com.google.android.gms.internal.firebase-auth-api.zzth.zzb(com.google.firebase:firebase-auth@@20.0.1:7)
at com.google.android.gms.internal.firebase-auth-api.zzth.onPostExecute(com.google.firebase:firebase-auth@@20.0.1)
at android.os.AsyncTask.finish(AsyncTask.java:660)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:677)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6276)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder" on path: DexPathList[[zip file "/data/app/com.wasali.mobile_authentication-1/base.apk"],nativeLibraryDirectories=[/data/app/com.wasali.mobile_authentication-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.1:13) 
at com.google.android.gms.internal.firebase-auth-api.zzth.zzb(com.google.firebase:firebase-auth@@20.0.1:7) 
at com.google.android.gms.internal.firebase-auth-api.zzth.onPostExecute(com.google.firebase:firebase-auth@@20.0.1) 
at android.os.AsyncTask.finish(AsyncTask.java:660) 
at android.os.AsyncTask.-wrap1(AsyncTask.java) 
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:677) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:203) 
at android.app.ActivityThread.main(ActivityThread.java:6276) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924) 
我尝试了许多解决方案,例如添加此依赖项,但它不起作用:
implementation androidx.browser:browser:1.2.0

implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-analytics'
implementation platform('com.google.firebase:firebase-bom:26.0.0')

最佳答案

我遇到了同样的问题,请尝试以下-

//import broswer(require for firebase reCaptch Verifications)
implementation 'androidx.browser:browser:1.2.0'

// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-analytics'
确保您输入 apply plugin: 'com.google.gms.google-services' // Google Services plugin 的顶部build.gradle(app) , 并在 中添加一个依赖项build.gradle(项目) 如下-
buildscript {
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'

classpath 'com.google.gms:google-services:4.3.4' // Google Services plugin

}

}
如果您遇到错误,因为“仅从 Android N 开始支持静态接口(interface)方法”,然后通过添加这些行将 Java 版本更新到 1.8
在您的 build.gradle(项目)
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
快乐编码!

关于android - 如何修复由 : java. 引起的 lang.ClassNotFoundException:找不到类 "androidx.browser.customtabs.CustomTabsIntent$Builder",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65400193/

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