gpt4 book ai didi

android - 当使用 .xml 代替 google_services.json 时,Gradle 构建失败

转载 作者:行者123 更新时间:2023-12-05 08:11:09 29 4
gpt4 key购买 nike

我正在设置 Firebase Crashlytics。当我使用 google_services.json 时它工作正常。但由于我们有多个构建变体,我更喜欢使用 .xml,所以我可以在控制台创建 2 个应用程序,在项目中创建 2 个文件:

-src/main/res/values/google_services.xml (for all builds, corresponds to test app at firebase)
-src/release/res/values/google_services.xml (for prod-release build)

我还删除了应用插件:'com.google.gms.google-services'

但是我的构建对于所有发布任务都失败了:

assembleTestRelease
assembleStageRelease

原因在

minifyEnabled true
shrinkResources true

在迁移到 Firebase Crashlytic(使用 Fabric)之前它运行良好。

错误:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:uploadCrashlyticsMappingFileTestRelease'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
...
Caused by: org.gradle.api.GradleException: Crashlytics could not find the resource file generated by Google Services. You may need to execute the :process<Variant>GoogleServices Task. Please check your Firebase project configuration (https://firebase.google.com/docs/android/setup).
at com.google.firebase.crashlytics.buildtools.gradle.ProjectVariantState.getGoogleAppId(ProjectVariantState.groovy:195)
... 35 more

最佳答案

您应该能够使用这些值成功地重新创建 google 服务 xml 文件:

google_app_id:

{YOUR_CLIENT}/client_info/mobilesdk_app_id

gcm_defaultSenderId:

project_info/project_number

default_web_client_id:

{YOUR_CLIENT}/oauth_client/client_id (client_type == 3)

ga_trackingId:

{YOUR_CLIENT}/services/analytics-service/analytics_property/tracking_id

firebase_database_url:

project_info/firebase_url

google_api_key:

{YOUR_CLIENT}/api_key/current_key

google_crash_reporting_api_key:

{YOUR_CLIENT}/api_key/current_key

项目编号:

project_info/project_id

关于android - 当使用 .xml 代替 google_services.json 时,Gradle 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63452858/

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