在使用FirebaseUI的身份验证时尝试使用Google登录进行登录时,出现Developer (Code:10, message:10:)错误。一切都能在开发中正常运行,但是当我使用上载密钥对捆绑包进行签名,然后在设备上运行它时,就会失败。
我查看了相关的问题here,here和here,但答案无济于事。正如您将在下面看到的那样,我已经尝试了他们的建议。
我尝试过的事情:
我的应用程序级build.gradle文件包含以下内容:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
android {
signingConfigs {
release {
storeFile file('myKeystore')
storePassword 'myPassword'
keyAlias 'upload'
keyPassword 'myPassword'
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.######.app"
minSdkVersion 28
targetSdkVersion 29
versionCode 24
versionName "Test version 1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation":
"$projectDir/schemas".toString()
]
}
}
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
}
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
sourceSets {
main {
res {
srcDirs 'src/main/res', 'src/main/res_birds'
}
}
}
}
dependencies {
// Jar libs
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Support libs
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
// Supernova UI Toolkit
implementation 'io.supernova:android-ui-toolkit:1.2.0'
// Play Services
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
// Page Control
implementation 'com.romandanylyk:pageindicatorview:1.0.0'
// Unit tests dependencies
implementation 'com.google.firebase:firebase-auth:19.3.1'
testImplementation 'junit:junit:4.13'
// Integration tests dependencies
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Room components
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
kapt "androidx.room:room-compiler:$rootProject.roomVersion"
androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$rootProject.roomVersion"
// Lifecycle components
kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.archLifecycleVersion"
// Kotlin components
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"
// Material design
implementation "com.google.android.material:material:$rootProject.materialVersion"
// Testing
testImplementation 'junit:junit:4.13'
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
// Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
// Stfalcon ImageViewer
implementation 'com.github.stfalcon:stfalcon-imageviewer:1.0.1'
// [START gradle_firebase_ui_auth]
implementation "com.firebaseui:firebase-ui-auth:6.2.1"
//Firebase
implementation 'com.google.firebase:firebase-analytics:17.4.3'
implementation 'com.google.firebase:firebase-core:17.4.3'
implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'
implementation "com.google.firebase:firebase-auth-ktx:19.3.1"
// Required only if Facebook login support is required
implementation 'com.facebook.android:facebook-android-sdk:7.0.0'
// [END gradle_firebase_ui_auth]
}
从Firebase测试实验室设备生成的日志中摘录:
06-21 12:11:29.915: E/AuthUI(14514): A sign-in error occurred.
06-21 12:11:29.915: E/AuthUI(14514): com.firebase.ui.auth.FirebaseUiException: Code: 10, message: 10:
06-21 12:11:29.915: E/AuthUI(14514): at com.firebase.ui.auth.data.remote.GoogleSignInHandler.onActivityResult(GoogleSignInHandler.java:112)
06-21 12:11:29.915: E/AuthUI(14514): at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onActivityResult(AuthMethodPickerActivity.java:361)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.Activity.dispatchActivityResult(Activity.java:7462)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.ActivityThread.deliverResults(ActivityThread.java:4391)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4440)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
06-21 12:11:29.915: E/AuthUI(14514): at android.os.Handler.dispatchMessage(Handler.java:106)
06-21 12:11:29.915: E/AuthUI(14514): at android.os.Looper.loop(Looper.java:193)
06-21 12:11:29.915: E/AuthUI(14514): at android.app.ActivityThread.main(ActivityThread.java:6718)
06-21 12:11:29.915: E/AuthUI(14514): at java.lang.reflect.Method.invoke(Native Method)
06-21 12:11:29.915: E/AuthUI(14514): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
06-21 12:11:29.915: E/AuthUI(14514): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
06-21 12:11:29.916: D/LifecycleMonitor(14514): Lifecycle status change: com.firebase.ui.auth.KickoffActivity@f99b9c3 in: RESUMED
06-21 12:11:29.940: I/GoogleInputMethod(1463): onFinishInput() : Dummy InputConnection bound
06-21 12:11:29.940: I/GoogleInputMethod(1463): onStartInput() : Dummy InputConnection bound
06-21 12:11:29.945: I/Icing(10330): Indexing done com.google.android.inputmethod.latin-internal.3p:StickerPack [CONTEXT service_id=21 ]
06-21 12:11:29.946: I/Icing(10330): Indexing com.google.android.inputmethod.latin-internal.3p:Sticker from com.google.android.inputmethod.latin [CONTEXT service_id=21 ]
06-21 12:11:29.948: D/LifecycleMonitor(14514): Lifecycle status change: com.firebase.ui.auth.KickoffActivity@f99b9c3 in: PAUSED
06-21 12:11:29.962: I/FirebaseUIActivity(14514): Request Code: 123, Result Code: 0
06-21 12:11:29.962: E/FirebaseUIActivity(14514): Sign in failed with response error code: 4, and message: Code: 10, message: 10:
在下面的屏幕截图中,是我在Firebase控制台上的SHA-1指纹。它们定义为:
从关键工具获取要发布的签名时,我得到:
在Google Play商店中,我的上传证书显示为:
在Google Play商店中,应用签名证书显示为:
我的用于上传密钥的OAuth 2客户端显示为:
我的google-services.json内容为:
{
"project_info": {
"project_number": "*******",
"firebase_url": "**********",
"project_id": "************",
"storage_bucket": "************"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:77*******:android:*******1e7",
"android_client_info": {
"package_name": "com.f***********.app"
}
},
"oauth_client": [
{
"client_id": "77************-2u******************.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.f***********.app",
"certificate_hash": "ea#####################################68"
}
},
{
"client_id": "7****************-do**************.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.f***********.app",
"certificate_hash": "3e#####################################a7"
}
},
{
"client_id": "7**************-k8**************.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.f***********.app",
"certificate_hash": "d0#####################################66"
}
},
{
"client_id": "7**************-sf**************.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AI**************_GQ"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "7**************-sf**************.googleusercontent.com",
"client_type": 3
},
{
"client_id": "7*********-3**************.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.f***********.app",
"app_store_id": "********"
}
}
]
}
}
}
],
"configuration_version": "1"
}
任何可以在下一步找到的想法都会受到赞赏。