简体   繁体   中英

Uploading debug symbols to Crashlytics without GoogleService-Info.plist

I'm working on integrating Firebase Crashlytics (as well as analytics) into my team's app. Due to various reasons, we're manually configuring an FIROptions object and calling -[FIROptions initWithGoogleAppId:GCMSenderID:] , configuring the properties we need, and then calling -[FIRApp configureWithName:options:] from there. This is working great, and I can see analytics working and crashes get uploaded to our Crashlytics dashboard

However, I can't get the build phase to upload the generated .dSYM files to succeed. The suggested script is to add this as the last step in the build process:

"${PODS_ROOT}/Fabric/run"

That phase should also be passed the Info.plist as an input file. However, when I remove the GoogleService-Info.plist from our bundle, the build fails with this error: Could not get GMP_APP_ID in Google Services file from build environment

This makes sense to me, because it's still looking for the GoogleService-Info.plist I removed. I wrote my own Python script to attempt to generate a temporary .plist file from our data, which currently looks like this:

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)

Running this script as a build phase generates the following error: Unable to read GoogleService-Info.plist at path /var/folders/4g/_p4pgc5d485gtcn_3dtys4y00000gn/T/tmp7m7r_0zj/GoogleService-Info.plist

I've also tried generating a normal NamedTemporaryFile , but that results in the same issue. Not running the script in build phase mode and manually passing the platform and symbol files results in the first error I got about the GMP_APP_ID . How can I make a build phase to automatically upload our debugging symbols to Crashlytics, without having to add a GoogleService-Info.plist to our project?

I made a tool that upload dSYM files to Crashlytics without anything.

Use it to solve your problem:
https://github.com/prsolucoes/fabric-upload-dsym

In "dist" folder you can find your correct version depending of your OS.

  • Windows
  • macOS
  • Linux

HOW TO USE

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

Replace in command with your info, example:

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

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM