我正在试用最近发布的功能,该功能允许使用gradle任务将ProGuard映射文件上传到Firebase(https://firebase.google.com/docs/crash/android)。以下是我正在运行的任务。

./gradlew -PFirebaseServiceAccountFilePath=xxxxx.json :app:firebaseUploadReleaseProguardMapping

但是,它似乎无法识别服务帐户文件。有人有运气吗?我也尝试过在gradle.properties中定义FirebaseServiceAccountFilePath
* What went wrong:
Execution failed for task ':app:firebaseUploadReleaseProguardMapping'.
> Service account file path has not been defined! Service accounts are used to authorize your mapping file uploads.  Learn more at
  https://firebase.google.com/docs/crash/android.

最佳答案

在gradle.properties中设置json的相对路径(在项目根目录中)

FirebaseServiceAccountFilePath = /firebase-crashreporting.json

并在build.gradle中更新此属性
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'

android {
    ...
}

setProperty("FirebaseServiceAccountFilePath", rootProject.rootDir.absolutePath + FirebaseServiceAccountFilePath)

dependencies {
    ...
}

关于android - 将ProGuard映射文件上传到Firebase,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41198758/

10-11 22:16
查看更多