【问题标题】:Uploading debug symbols to Crashlytics without GoogleService-Info.plist在没有 GoogleService-Info.plist 的情况下将调试符号上传到 Crashlytics
【发布时间】:2019-06-19 16:12:37
【问题描述】:

我正在努力将 Firebase Crashlytics(以及分析)集成到我团队的应用中。由于各种原因,我们手动配置一个FIROptions对象并调用-[FIROptions initWithGoogleAppId:GCMSenderID:],配置我们需要的属性,然后从那里调用-[FIRApp configureWithName:options:]。这很好用,我可以看到分析工作正常,崩溃会上传到我们的 Crashlytics 仪表板

但是,我无法在构建阶段上传生成的.dSYM 文件以成功。建议的脚本是将其添加为构建过程的最后一步:

"${PODS_ROOT}/Fabric/run"

该阶段也应该通过Info.plist 作为输入文件。但是,当我从捆绑包中删除 GoogleService-Info.plist 时,构建失败并出现以下错误:Could not get GMP_APP_ID in Google Services file from build environment

这对我来说很有意义,因为它仍在寻找我删除的 GoogleService-Info.plist。我编写了自己的 Python 脚本,试图从我们的数据中生成一个临时的 .plist 文件,目前看起来像这样:

import subprocess
import tempfile
import plistlib
import pathlib

firebase_app_id: str = "<# OUR FIREBASE APP ID HERE #>"

with tempfile.TemporaryDirectory() as temp_folder, open(pathlib.Path(temp_folder) / "GoogleService-Info.plist", "wb") as temp_plist:
    plistlib.dump({"GOOGLE_APP_ID": firebase_app_id}, temp_plist)
    subprocess.run([f"{os.environ['PODS_ROOT']}/Fabric/upload-symbols", "--google-service-plist", temp_plist.name, "--build-phase", "--debug"], check=True)

将此脚本作为构建阶段运行会产生以下错误:Unable to read GoogleService-Info.plist at path /var/folders/4g/_p4pgc5d485gtcn_3dtys4y00000gn/T/tmp7m7r_0zj/GoogleService-Info.plist

我也尝试过生成一个普通的NamedTemporaryFile,但这会导致同样的问题。不在构建阶段模式下运行脚本并手动传递平台和符号文件会导致我收到关于GMP_APP_ID 的第一个错误。如何在构建阶段自动将我们的调试符号上传到 Crashlytics,而无需向我们的项目添加 GoogleService-Info.plist

【问题讨论】:

    标签: python ios xcode firebase crashlytics


    【解决方案1】:

    我制作了一个工具,无需任何东西即可将 dSYM 文件上传到 Crashlytics。

    用它来解决你的问题:
    https://github.com/prsolucoes/fabric-upload-dsym

    "dist" 文件夹中,您可以根据您的操作系统找到正确的版本。

    • 窗口
    • macOS
    • Linux

    如何使用

    fabric-upload-dsym --bundleid=[YOUR-APP-BUNDLE] --fabricapikey=[YOUR-FABRIC-API-KEY] --file=[ZIPPED-DSYM-FILE]
    

    用你的信息替换命令,例如:

    [YOUR-APP-BUNDLE] = com.prsolucoes.myapp
    [YOUR-FABRIC-API-KEY] = 12xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbf
    [ZIPPED-DSYM-FILE] = /tmp/yourapp/dsym.zip
    

    谢谢。

    【讨论】:

      猜你喜欢
      • 2022-12-11
      • 2019-10-17
      • 2013-12-06
      • 1970-01-01
      • 2021-02-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多