Skip to main content
A native crash on Android (C or C++ code, built with the NDK) reaches Apsio as the frames of the system’s crash report: each frame names a library, an offset into it and the library’s GNU build id. Apsio turns libshop.so + 0x398 into cart_total in shop.c:13, inlined frames included, with that library’s debug information. See Android native code for what is symbolicated. Native crash reports come from Android 12 and later. The stack of a native crash on older versions is not available to apps.

With the Gradle plugin

The Apsio Gradle plugin (io.apsio.gradle) does it on every release build. Its nativeSymbols option is on by default:
  • Release build types get ndk.debugSymbolLevel = "FULL" unless they set it, so the libraries in the app are stripped, and their debug information is kept in the build’s output.
  • After the build, the plugin uploads with apsio upload ndk the unstripped copy of each library the app packages that has symbols. Debug information gives functions, files and lines; a symbol table alone (a library built without -g) gives function names. A library that was already stripped before the build has nothing to upload. A .so.dbg your build adds to AGP’s native debug metadata is uploaded instead of its library.
  • The upload goes under the build id the plugin writes into the manifest, next to the R8 mapping, and uses the token in APSIO_TOKEN, as the mapping does.

With the CLI

From a build script or CI, after the build:
  • The directory (here native-debug-symbols) holds one subdirectory per ABI, arm64-v8a, armeabi-v7a, x86, x86_64 and riscv64, with the libraries’ ELF files that have debug information: the .so.dbg files of debugSymbolLevel = "FULL" (AGP also zips them, in this layout, into app/build/outputs/native-debug-symbols/<variant>/native-debug-symbols.zip for Google Play: unzip it and pass the folder), or unstripped .so files.
  • Each file is uploaded under its GNU build id, the id native crashes carry, with its ABI and the library’s name. A file that is not ELF, has no build id, has no symbols (a stripped library) or belongs to another ABI is skipped with a warning.
  • --build-id is the build id in the app’s manifest, the one its R8 mapping uses (see Give the build an id). Apsio records which libraries that build ships.
  • A library Apsio already has is not sent again: a library you did not change keeps its build id across builds. --force uploads everything again. --dry-run checks the files without a token or an upload, and --json prints a report.
  • The command succeeds when every library was uploaded or Apsio had it already. When any upload fails it exits with an error (4 when the server rejected the files, 1 for network or server errors), after uploading the others, so a build that treats upload errors as failures stops.
Link your libraries with a build id: the NDK’s toolchain does it by default (-Wl,--build-id). A library without one cannot be matched to its crashes.

Libraries from dependencies

A library an AAR dependency ships (a vendor’s SDK) is part of the app like your own, so without its debug file it shows under the release’s missing symbols ("kind": "native_library").
  • When the dependency ships it with debug information or a symbol table, the plugin uploads it with your own libraries: nothing to do. With a symbol table alone, its frames get function names but no files or lines.
  • When the vendor ships it stripped, there is nothing to upload. Ask the vendor for the unstripped .so or its .so.dbg for the version you ship, and upload it with apsio upload ndk under the build’s id. Without it, the library’s frames keep the names the device gives (its exported functions) and still group.
AGP strips only with an NDK it can use: the version in ndkVersion, or its default when you set none, installed in the Android SDK. Without one it packages the libraries as they are, with their debug information, so the app is larger; the plugin still uploads their symbols.

When a native crash stays unsymbolicated

  • The build’s debug files were never uploaded, or come from another build: a rebuild of the same code can produce other build ids.
  • The library was linked without a build id.
  • The frame is in a library of the system (libc.so, libart.so): those keep the function name the device gives and are never listed as missing.
The release’s missing symbols list your libraries that crashes used and that have no upload, by the debug id made from their build id. Crashes that arrived before the upload are symbolicated when it lands, and grouped again by function names.