Crashlytics NDK symbol building from command line

I work on the Fabric team that maintains our Crashlytics NDK support.

To give some context - our symbol upload tool is based on the ndk-build process which produces 2 sets of binaries: your production binaries, which are stripped of symbol data, and debug binaries, which have symbol data intact for debugging purposes.

The Gradle properties map to variables in the ndk-build process, specifically:

  • androidNdkOut is the directory under which the unstripped, debug binaries are placed (equivalent to the $NDK_OUT variable in ndk-build) called obj by default.
  • androidNdkLibsOut is the directory under which the stripped, release binaries are placed (equivalent to the $NDK_LIBS_OUT variable in ndk-build) called libs by default.

The expected contents of these paths are the architecture-specific directories for your libraries, so for example:

obj/
  — armeabi
    — lib1.so
    — lib2.so
  — x86
    — lib1.so
    — lib2.so

libs/
  — armeabi
    — lib1.so
    — lib2.so
  — x86
    — lib1.so
    — lib2.so

All you’ll need to do for our symbol upload to work is to generate these same sets of binaries from CMake, and then set your androidNdkOut and androidNdkLibsOut to the appropriate top-level directories where those libraries can be found.

EDIT/UPDATE July 7, 2017

We've just released version 1.23.0 of the Fabric plugin for Gradle which supports automatically resolving the appropriate native library paths when you're using the Android Gradle plugin 2.2.0+ with the externalNativeBuild DSL, so you no longer have to set androidNdkOut and androidNdkLibsOut if you're using the latest Android Gradle plugin. Check out more info here: https://docs.fabric.io/android/crashlytics/ndk.html#specifying-the-path-to-debug-and-release-binaries