Task :app:uploadCrashlyticsMappingFileRelease FAILED Expected file collection to contain exactly one file, however, it contains no files

12,595

Solution 1

Error: "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."

I had something like this in build.gradle

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

changed it to this and voila! it works:

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

Solution 2

I faced the same event today.The reason for this to happen is as follows.

If minify true is set, obfuscation will be applied at build time and mapping.txt will be created.

If minify false, it will not be obfuscated at build time and mapping.txt will not be created.

If you set mappingFileUploadEnabled true in the minify false state, the Firebase SDK will try to upload mapping.txt to Firebase even though mapping.txt is not created at build time. The result is an error.

So, if you set minify false, you have to set mappingFileUploadEnabled false, if you set minify true, you need to set mappingFileUploadEnabled true or false (when mappingFileUploadEnabled false, the crash log on Firebase was obfuscated. It may not make much sense as it will be displayed in state).

  • Hint

https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android#firebase-crashlytics-sdk_7

https://developer.android.com/studio/build/shrink-code#enable

Solution 3

I have resolved this issue by moving the following line from bottom of the page to top in build gradle.

Previous Settings:

apply plugin: 'com.google.gms.google-services'

New Settings:

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

And the issue is resolved.

Solution 4

In my case I received the error because I wasn't connected to the internet. Fixed it by connecting to the internet and my build release worked perfectly for my Flutter App.

Solution 5

Just change sequence of crashlytics, apply plugin as below :

// Put Google Service
apply plugin: 'com.google.gms.google-services'
// After that the Firebase Crashlytics plugin.
apply plugin: 'com.google.firebase.crashlytics'
Share:
12,595
Reyjohn
Author by

Reyjohn

I develop android application from the very beginning of my career.

Updated on June 23, 2022

Comments

  • Reyjohn
    Reyjohn about 2 years

    I have implemented Firebase crashlytics as suggested. I have put this in my app level release build variant:

    firebaseCrashlytics
      {
        mappingFileUploadEnabled true
      }
    

    but when I start to build signed apk I am always getting this error

    Task :app:uploadCrashlyticsMappingFileRelease FAILED

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.

    Expected file collection to contain exactly one file, however, it contains no files.

    If I set mappingFileUploadEnabled to false then release apk builds successfully. I have searched a lot but couldn't find a work around. Anyone can help?