【问题标题】:firebase-crashlytics-gradle plugin fails with exception 'googleServicesResourceRoot' doesn't have a configured valuefirebase-crashlytics-gradle 插件失败,异常“googleServicesResourceRoot”没有配置值
【发布时间】:2021-09-05 14:18:34
【问题描述】:

将 crashlytics 插件“com.google.firebase.crashlytics”应用到我的项目后, 我的构建失败并出现异常:

// build.gradle.kts
buildscript {
    repositories {
        google()
    }
    dependencies {
        classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
    }
}

apply(plugin = "com.google.firebase.crashlytics")
$ ./gradlew

...

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':platforms:mobile:android:app:uploadCrashlyticsMappingFileCglDevRelease' (type 'UploadMappingFileTask').
  - In plugin 'com.google.firebase.crashlytics' type 'com.google.firebase.crashlytics.buildtools.gradle.tasks.UploadMappingFileTask' property 'googleServicesResourceRoot' doesn't have a configured value.
    
    Reason: This property isn't marked as optional and no value has been configured.
    
    Possible solutions:
      1. Assign a value to 'googleServicesResourceRoot'.
      2. Mark property 'googleServicesResourceRoot' as optional.

如何在不使用 google-play-services 插件的情况下避免此 gradle 异常,并且仍将成功的混淆映射上传到 firebase crashlytics?

firebase-crashlytics-gradle 插件对 googleServicesResourceRoot 的期望是什么?建立风味资源根? google-services.json 文件所在的目录? (我不使用)?

我找到了Type 'UploadMappingFileTask' property 'googleServicesResourceRoot' doesn't have a configured value,其根本原因和公认的解决方案是在 crashlytics 插件之前应用 google-play-services 插件。

但是,我们没有使用 google-play-services 插件,并且我们不打算在未来使用它。

【问题讨论】:

  • 您找到解决方案了吗?我们处于完全相同的位置。
  • 我没有找到合适的解决方案,但作为(希望是临时的)解决方法,我不得不启用不需要的 google-play-plugin

标签: android firebase gradle android-gradle-plugin crashlytics-android


【解决方案1】:

我们也没有使用 google 服务插件,因此出现此错误。

对于我们想要连接到 Firebase 和 Crashlytics 的每种风格,我们都有一个名为 values.xml 的 xml 资源文件,其中包含资源文件值中所需的 Firebase 属性(project_idgoogle_app_idgoogle_crash_reporting_api_key 等)文件夹(例如app/src/prodRelease/res/values/values.xml)。

在应用级别 build.gradle.kts 我们有:

project.afterEvaluate {
    tasks.withType<UploadMappingFileTask> {
        val myDirProp = project.objects.directoryProperty().fileValue(file("src/prodRelease/res"))
        googleServicesResourceRoot.value(myDirProp)
    }
}

这会设置googleServicesResourceRoot 并成功将映射文件上传到 Crashlytics。

【讨论】:

    猜你喜欢
    • 2020-10-04
    • 2023-02-21
    • 2021-08-24
    • 2021-11-17
    • 2017-07-05
    • 2019-01-05
    • 2022-06-14
    • 2018-07-07
    • 2015-02-06
    相关资源
    最近更新 更多