类型“UploadMappingFileTask”属性“googleServicesResourceRoot”没有配置值

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

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

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
6个回答
135
投票

要修复它,应在

/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
ABOVE
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.

21
投票

确定

'com.google.gms.google-services'

适用于:

'com.google.firebase.crashlytics'

为我修复了错误。


5
投票

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


0
投票

我的项目没有使用

'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
之前,如其他答案所述。


0
投票

我已经按照正确的顺序使用了应用插件行,但我仍然收到有关未找到插件任务的构建错误和同步警告。我考虑过升级 google-services 的可能性,但 4.1.0 版已经是我能做到的最高版本了。再高一点,我就会收到有关未找到库依赖项的错误消息。

事实证明,我不仅需要将 google-services 升级到 4.3.14,在项目级 build.gradle 中定义

mavenCentral()
存储库还不够;它还需要在应用程序级别的 build.gradle 中定义。

buildscript {
    repositories {
        google()
        mavenCentral() // Add this line
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.14'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

入门文档中没有任何地方提到需要这样做,所以希望这能帮助任何陷入与我相同情况的人。


0
投票

当我在我的

minifyEnabled true
构建中测试
debug
时,这发生在我身上。

将以下内容添加到我的调试 buildTypes 为我解决了这个问题。

      firebaseCrashlytics
          {
            mappingFileUploadEnabled false
          }
© www.soinside.com 2019 - 2024. All rights reserved.