![](/img/trans.png)
[英]Firebase Phone number authentication Failed to resolve: com.google.firebase:firebase-auth:11.0.0
[英]Phone authentication google firebase failed
我使用了 google firebase 電話身份驗證,這是我的代碼: https : //codeshare.io/5MrgVy直到昨天它都有效,今天每次我輸入電話號碼時都會出現吐司,在這種情況下應該出現:
public void onVerificationFailed (FirebaseException e) {loadingBar.dismiss ();
Toast.makeText (RegistrationActivity.this, "Invalid number entered ...", Toast.LENGTH_SHORT) .show ();
relativeLayout.setVisibility (View.VISIBLE);
continueAndNextBtn.setText ("Continue"); // Continue
codeText.setVisibility (View.GONE);
}
最近我做了一個引用器來更改項目包的名稱,這樣做后它給了我這個錯誤:沒有找到包名稱“com.conta.ftof”的匹配客戶端我通過替換谷歌中的舊包解決了這個錯誤- services.json 與新的。 我告訴你這個是因為我擔心這就是原因。 我怎樣才能解決認證事實?
編輯:
我在構建輸出中注意到了這個奇怪的事情:
activity#com.google.firebase.auth.internal.FederatedSignInActivity@android: launchMode 在 AndroidManifest.xml: 24 被標記為替換其他聲明但沒有其他聲明存在
日志貓
2020-10-11 21:25:28.819 15302-15302/com.conta.ftof E/RegistrationActivity: err : com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
Android清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.conta.ftof">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".donate" />
<activity android:name=".VideoCallActivity" />
<activity android:name=".CallingActivity" />
<activity android:name=".ProfileActivity" />
<activity android:name=".FindPeopleActivity" />
<activity android:name=".NotificationsActivity" />
<activity android:name=".SettingsActivity" />
<activity
android:name=".ContactsActivity"
android:label="@string/title_activity_main" />
<activity android:name=".RegistrationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3400243939195187~6852949310"/>
<receiver android:name=".ReminderBroadcast"/>
</application>
</manifest>
失敗的原因可能有很多。 你可以試試下面的
嘗試檢查每個案例
[編輯]:Firebase 電話授權錯誤處理
試試下面的代碼,它會幫助你一點
@Override
public void onVerificationFailed(FirebaseException e) {
if (e instanceof FirebaseAuthInvalidCredentialsException) {
// Failed to verify due to wrong format mobile number
} else if (e instanceof FirebaseTooManyRequestsException) {
// Failed to verify due to usage over quota limit
}
}
@哈卡爾
logcat后點擊btn continue
2020-10-11 21:25:28.819 15302-15302/com.conta.ftof E/RegistrationActivity: err : com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
我解決了。 原因是我更改了包名稱,因此也必須更改 firebase 中的包名稱。 我在 firebase 上創建了一個新應用,這次我輸入了正確的包名,用舊的替換了 google-services.json 文件......現在它可以工作了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.