【问题标题】:Type 'UploadMappingFileTask' property 'googleServicesResourceRoot' doesn't have a configured value类型“UploadMappingFileTask”属性“googleServicesResourceRoot”没有配置值
【发布时间】:2021-08-24 03:57:33
【问题描述】:

更新类路径后,我无法再构建应用的发布版本。

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:uploadCrashlyticsMappingFileRelease' (type 'UploadMappingFileTask').
  - Type '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.



    A problem was found with the configuration of task ':app:uploadCrashlyticsMappingFileRelease' (type 'UploadMappingFileTask').
  - Type 'UploadMappingFileTask' property 'googleServicesResourceRoot' doesn't have a configured value.

我试图阅读更新日志,但没有任何指南或文档。

【问题讨论】:

    标签: firebase crashlytics crashlytics-android


    【解决方案1】:

    要解决此问题,应在 /app/build.gradle 中的任何 Firebase 插件之前应用 Google 服务插件。

    这会产生错误:

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.firebase.crashlytics'
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'com.google.firebase.firebase-perf'
    

    虽然不是这样:

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'com.google.firebase.crashlytics'
    apply plugin: 'com.google.firebase.firebase-perf
    

    请注意,com.google.gms.google-services 高于 com.google.firebase.crashlytics

    当您更新到 com.google.firebase:firebase-crashlytics-gradle:2.7.0 并同步更改时,您会收到一条消息,说明修复如下:

    Configure project :app
    Crashlytics could not find Google Services plugin task: processReleaseGoogleServices. Make sure com.google.gms.google-services is applied BEFORE com.google.firebase.crashlytics. If you are not using the Google Services plugin, you must explicitly declare `googleServicesResourceRoot` inputs for Crashlytics upload tasks.
    

    【讨论】:

    • 我记得把那行放在底部(见here)...现在又改了...
    • @Vall0n 他们在文档中将其更改为最顶部:firebase.google.com/docs/android/setup#add_the_sdk
    • 修复了问题,但 gradle 开始显示警告:“警告:请在构建文件的底部应用 google-services 插件。” :)
    【解决方案2】:

    确定

    'com.google.gms.google-services'
    

    在之前应用:

    'com.google.firebase.crashlytics'
    

    为我修复了错误。

    【讨论】:

    • 这对新版本起到了作用,但在以前的版本中这不是问题。
    【解决方案3】:

    我也没有找到任何东西,现在将 firebase-crashlytics-gradle 更改为 2.6.1 似乎没问题。

    【讨论】:

    【解决方案4】:

    我的项目没有使用'com.google.gms.google-services'。您需要将'com.google.gms.google-services'添加到插件中的应用级Gradle文件中,并在项目级Gradle文件中添加其对应的类路径依赖classpath 'com.google.gms:google-services:latest-version'

    如其他答案所述,还要确保 com.google.gms.google-services 出现在 com.google.firebase.crashlytics 之前。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-30
      • 2020-01-15
      • 1970-01-01
      • 1970-01-01
      • 2022-08-06
      • 2022-01-15
      • 1970-01-01
      • 2021-10-19
      相关资源
      最近更新 更多