将ProGuard映射文件上载到Firebase

Joh*_*lly 12 android firebase firebase-crash-reporting

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

./gradlew -PFirebaseServiceAccountFilePath=xxxxx.json :app:firebaseUploadReleaseProguardMapping
Run Code Online (Sandbox Code Playgroud)

但是,它似乎没有识别服务帐户文件.有没有人有幸得到这个工作?我也尝试过FirebaseServiceAccountFilePath在gradle.properties中定义.

* 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.
Run Code Online (Sandbox Code Playgroud)

Ole*_*kun 24

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

FirebaseServiceAccountFilePath = /firebase-crashreporting.json
Run Code Online (Sandbox Code Playgroud)

并在build.gradle中更新此属性

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'

android {
    ...
}

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

dependencies {
    ...
}
Run Code Online (Sandbox Code Playgroud)


Dou*_*son 5

错误消息具有误导性.如果找不到为服务帐户提供的文件路径,您将看到.尝试传递服务帐户文件的完整,明确的路径(尽量不要依赖于相对路径).

我将确保插件的下一个版本对于找不到该文件的情况有更有意义的错误消息.抱歉有问题.