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

a11xaf1n  于 2023-03-03  发布在  Go
关注(0)|答案(6)|浏览(104)

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

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.

我尝试阅读变更日志,但没有相关指南或文档。

4nkexdtk

4nkexdtk1#

要解决这个问题,Google服务插件应该在/app/build.gradle中的任何Firebase插件之前应用。
这将产生以下错误:

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.
az31mfrm

az31mfrm2#

确保

'com.google.gms.google-services'

适用于:

'com.google.firebase.crashlytics'

帮我修正了错误。

w8rqjzmb

w8rqjzmb3#

我也没有发现任何东西,现在改变到2.6.1的firebase-crashlytics-gradle似乎可以。

frebpwbc

frebpwbc4#

我的项目没有使用'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之前,如其他答案所述。

mi7gmzs6

mi7gmzs65#

我已经把apply plugin行按正确的顺序写好了,但是我仍然收到构建错误和关于插件任务找不到的同步警告。我考虑过升级google-services的可能性,但是4.1.0版本已经是我能做到的最高版本了。再高的话,我就会收到关于库依赖项找不到的错误。
事实证明,我不仅需要将google-services升级到4.3.14,在项目级构建中定义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'

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

l7wslrjt

l7wslrjt6#

当我在我的debug构建中测试minifyEnabled true时,发生了这种情况。
向我的调试构建类型添加以下内容为我解决了这个问题。

firebaseCrashlytics
          {
            mappingFileUploadEnabled false
          }

相关问题