Search code examples
firebaseandroid-ndkcrashlytics

Crashlytics NDK How to Enable native symbol uploading


I am tring to enable crashlytics for my NDK android app. Ive followed the the guide here. I got stuck on Step 2.

Step 2: Enable native symbol uploading To produce readable stack: traces from NDK crashes, Crashlytics needs to know about the symbols in your native binaries. Our Gradle plugin includes the uploadCrashlyticsSymbolFileBUILD_VARIANT task to automate this process (to access this task, make sure nativeSymbolUploadEnabled is set to true).

For method names to appear in your stack traces, you must explicitly invoke the uploadCrashlyticsSymbolFileBUILD_VARIANT task after each build of your NDK library. For example:

>./gradlew app:assembleBUILD_VARIANT\
           app:uploadCrashlyticsSymbolFileBUILD_VARIANT

What does For method names to appear in your stack traces, you must explicitly invoke the uploadCrashlyticsSymbolFileBUILD_VARIANT task after each build of your NDK library.mean? I also saw that they left a line with gradlew. Is this a command on a command line? I am very lost. Can anyone help me achieve step 2?


Solution

  • When you add "nativeSymbolUploadEnabled true" to your gradle file like mentioned in Step1 this will instruct the gradle plugin to generate a new task with the format "uploadCrashlyticsSymbolFileBUILD_VARIANT" for each build type and architectures. Check this screenshot where I only have one build type "release" but also have three architectures. The tasks generated are:

    1. uploadCrashlyticsSymbolFileArm8Release
    2. uploadCrashlyticsSymbolFileUniversalRelease
    3. uploadCrashlyticsSymbolFileX86_64Release

    enter image description here

    To run these tasks, you will need to either execute the command in a terminal updated for the desired build variant, e.g.

    >./gradlew app:assembleX86_64\
           app:uploadCrashlyticsSymbolFileX86_64Release
    

    Or manually calling those tasks in the gradle tab. They need to be executed in this order (first the assemble and then the uploadCrashlyticsSymbolFile...) to make sure the binaries have been created for Crashlytics to generate and upload the symbol files.

    To answer your question: What does For method names to appear in your stack traces, you must explicitly invoke the uploadCrashlyticsSymbolFileBUILD_VARIANT task after each build of your NDK library.mean? Crashlytics will need the symbol files in order to convert the crash report into a readable stack trace with method names and line numbers.