我基于Firebase的应用程序运行良好,稳定地在吸引用户。但是今天,我在更新Firebase库(包括身份验证库)时发布了一个小更新
implementation 'com.google.firebase:firebase-auth-ktx:19.3.2'
这也是我使用Android Studio 4.0的第一个版本 我一直在推迟更新,因为与Proguard与最近发布的版本的兼容性存在一些问题。在调试模式下进行测试并未引发新库的任何问题。
但是自发布以来,该应用程序的移动身份验证不起作用。下图提供了我收到的onVerificationFailed错误。
由于这在调试模式下有效,但在发行模式下失败,因此我怀疑这可能是Proguard的问题(尽管不确定)。我的保镖规则如下:
-keep class com.google.firebase.** { *; }
-keep class androidx.appcompat.widget.** { *; }
-keepattributes Signature
但是最新版本的Android Student 4.0使用这些规则提供了Unresolved Class Name错误。我检查了Stackoverflow的其他部分,看来这是截至日期的未解决问题。
最近12个小时,我一直在挠挠头。
更新(添加验证码):
fun verificationCallBacks(){
mCallbacks = object: PhoneAuthProvider.OnVerificationStateChangedCallbacks(){
override fun onVerificationCompleted(credential: PhoneAuthCredential) {
signIn(credential)
}
override fun onVerificationFailed(p0: FirebaseException) {
progressBarHolder.visibility = View.GONE
// Toast.makeText(this@LoginPopUp, "Error: Please check the number you entered", Toast.LENGTH_SHORT).show()
Toast.makeText(this@LoginPopUp, "Reporting Issue: $p0", Toast.LENGTH_LONG).show()
// I made this Toast to get what is happening in the release version
if (p0 is FirebaseAuthInvalidCredentialsException) {
} else if (p0 is FirebaseTooManyRequestsException) {
}
}
override fun onCodeSent(p0: String, p1: PhoneAuthProvider.ForceResendingToken) {
//Do something
//Token should have been received here. But token is not sent
}
}
}