Android Firebase 应用分发 - 服务凭据文件不存在。请检查服务凭据路径并重试

Android Firebase app distribution - Service credentials file does not exist. Please check the service credentials path and try again

我正在尝试从 Crashlytics Beta 迁移到 Firebase App Distribution。 CircleCi 在中间.

CircleCi 中的构建失败并出现以下错误:

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

这是我配置 serviceCredentialsFile 变量的方式 在我的 build.gradle:

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

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

文件 api-project-xxx-yyy.json 与 build.gradle 文件位于同一文件夹中。 我也试过:

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

仍然没有运气...... 如果有人能帮助我,我将不胜感激。

尝试使用相对路径:

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

很可能您的 api-project-xxx-yyy.json 不在您的根目录中,但您想使用项目的目录。

尝试使用$rootDir获取路径。例如,如果您将凭据文件 api-project-xxx-yyy.json 传递到根目录,那么您可以像这样获取它:

    firebaseAppDistribution {
        ...
        serviceCredentialsFile="$rootDir/api-project-xxx-yyy.json"
    }

最后做了以下事情:

    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 存在于:

  • 主文件夹
    • .想法
    • 应用程序
    • 建设
    • file.json

我用VS-Code。我在资源管理器中的 json 文件上 right-clicked,复制路径(完整路径)并在 build.gradle

中设置

serviceCredentialsFile=“路径”