FirestoreAndroid App App数据加载错误是基于经纪人Android.gms的错误

问题描述 投票:0回答:1

项目模块Gradle文件

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'


}


    implementation 'com.google.android.gms:play-services-auth:21.3.0'


    implementation 'com.google.firebase:firebase-analytics'

   // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:31.0.2')

这是项目gradle文件,我复制了Firebase Console中提供的确切版本。

buildscript { dependencies { classpath 'com.google.gms:google-services:4.3.14' } }// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { id 'com.android.application' version '7.4.2' apply false id 'com.android.library' version '7.4.2' apply false id 'org.jetbrains.kotlin.android' version '1.8.0' apply false id 'com.google.gms.google-services' version '4.3.10' apply false }
    

1。验证Google-Services.json放置和配置
android firebase kotlin android-studio google-cloud-firestore
1个回答
0
投票
确定您的

google-services.json文件放在app/

目录中。在您的模块级

build.gradle

中,您应该有:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    // Your Android configuration here
}

dependencies {
    implementation 'com.google.firebase:firebase-analytics:20.1.0'
    // Other dependencies
}
这种配置告诉Gradle使用Firebase服务,并验证JSON文件是否正确处理。

2。检查您的SHA证书

确保您的调试或发行键的SHA-1(和SHA-256(如果需要))在您的Firebase项目中注册。您可以使用gradle命令生成签名报告:

./gradlew signingReport 查看输出并将SHA值与firebase项目设置中的值进行比较。这样可以确保正确识别凭据匹配和您的应用程序。

3。更新Google Play服务

确认您的设备具有最新版本的Google Play服务,并且您的项目依赖性是最新的。您可以将Firebase库更新为您的最新版本。


4。设备特定设置(小米设备)

小米设备,MIUI优化可能会干扰应用程序安装或服务。您可以尝试禁用MIUI优化:

to to
SETTINGS>其他设置>设备上的开发人员选项。


分配miui优化并禁用它们。

这种设置可以帮助避免可能阻止应用程序和Google Play服务之间正确通信的问题。

这些示例应帮助您指导您在Android Project中与Google Play服务相关的潜在错误配置。
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.