12

I'm trying to migrate from Crashlytics Beta to Firebase App Distribution. CircleCi in the Middle.

The build failes in CircleCi with the following error:

  • What went wrong: Execution failed for task ':FiverrApp:appDistributionUploadRelease'. Service credentials file does not exist. Please check the service credentials path and try again

Here is how i'm configuring serviceCredentialsFile variable In my build.gradle:

        release {
        buildConfigField "boolean", "FORCE_LOGS", "true"

        firebaseAppDistribution {
            releaseNotes="Notes\n" + getCommitMessages()
            groups="android-testers"
            serviceCredentialsFile="/api-project-xxx-yyy.json"
        }
    }

the file api-project-xxx-yyy.json is in the same folder with build.gradle file. I've also tried:

serviceCredentialsFile="api-project-xxx-yyy.json"
serviceCredentialsFile='api-project-xxx-yyy.json'

And still no luck... Would appreciate if someone can help me.

Udi Oshi
  • 6,787
  • 7
  • 47
  • 65

4 Answers4

11

Try to use $rootDir to get a path. For example if you pass you credentials file api-project-xxx-yyy.json to root directory than you can take it something like this:

    firebaseAppDistribution {
        ...
        serviceCredentialsFile="$rootDir/api-project-xxx-yyy.json"
    }
cosic
  • 890
  • 12
  • 20
  • 1
    windows --> i have given full path still im getting error `> Service credentials file does not exist. Please check the service credentials path and try again` got advice? – Wini Nov 30 '20 at 12:55
  • I have the same error with `rootDir` but when I log `System.out.println("serviceCredentialsFile: $rootDir/api-project-xxx-yyy.json")` I get the correct path... – Melvynx Nov 29 '21 at 09:34
3

Try using a relative path instead:

serviceCredentialsFile = "./api-project-xxx-yyy.json"

Most likely your api-project-xxx-yyy.json is not in your root directory but you want to use the project's directory.

m02ph3u5
  • 3,022
  • 7
  • 38
  • 51
0

I use VS-Code. I right-clicked on the json file in Explorer, copied the path (the full path) and set it in build.gradle

serviceCredentialsFile= "path"

Sunil Gupta
  • 666
  • 6
  • 20
-1

Ended up doing the following:

    buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }

    release {
        minifyEnabled false
        debuggable false
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        firebaseAppDistribution {
            releaseNotes = "Notes\n" + getCommitMessages()
            groups = "android-testers"
            serviceCredentialsFile = "file.json"
        }
    }
}

file.json exist in:

  • Main Folder
    • .idea
    • app
    • build
    • file.json
Udi Oshi
  • 6,787
  • 7
  • 47
  • 65
  • I tried this solution but it just gave me the same error message "Service credentials file does not exist. Please check the service credentials path and try again" Any other idea what causes this? Seems like it is looking in completely wrong place. It looks in my /.gradle/daemon/6.0.1/ path. – Wox Jan 30 '20 at 15:17
  • @Wox In my case it was related to granting permissions between firebase and the google cloud dashboard (Place where Firebase admin permission) – Udi Oshi Feb 02 '20 at 07:16