By default, native code libraries are stripped in release builds of your app. This stripping consists of removing the symbol table and debugging information contained in any native libraries used by your app. Stripping native code libraries results in significant size savings; however, it's impossible to diagnose crashes on the Google Play Console due to the missing information (such as class and function names). To debug crashes, you must include a debug symbols file with your app in Play Console.
Upload a symbols file
The Google Play Console reports native crashes under Android vitals. With a few steps, you can generate and upload a native debug symbols file for your app. This file enables symbolicated native crash stack traces (that include class and function names) in Android vitals to help you debug your app in production. These steps vary depending on the version of the Android Gradle plugin used in your project and whether you're using an Android App Bundle (recommended) or APK.
Android Gradle plugin version 4.1 or later
If your project builds an Android App Bundle (AAB), you can configure your build
to automatically include the native debug symbols file in the AAB so it's
uploaded to the Play Console when you publish your app. To include this file in
release builds, add the following to your app's build.gradle.kts file:
android.buildTypes.release.ndk.debugSymbolLevel = { SYMBOL_TABLE | FULL }
Select the debug symbol level from the following:
- Use
SYMBOL_TABLEto get function names in the Play Console's symbolicated stack traces. This level supports tombstones. - Use
FULLto get function names, files, and line numbers in the Play Console's symbolicated stack traces.
If your project builds an APK, use the
android.buildTypes.release.ndk.debugSymbolLevel setting shown earlier to
generate the native debug symbols file separately. Manually upload the native
debug symbols
file
to the Google Play Console (the process is similar to uploading a mapping file
to deobfuscate stack traces).
As part of the build process, the Android Gradle plugin outputs this file in the
following project location:
app/build/outputs/native-debug-symbols/<var>variant-name</var>/native-debug-symbols.zip
If your dependencies contain native libraries, the debug information is likely
stripped to reduce size. You can verify this by running a build with the info
log level and setting debugSymbolLevel = { SYMBOL_TABLE | FULL }.
Then look for the following line in the build output:
Unable to extract native debug metadata from ... because the native debug metadata has already been stripped.
Android Gradle plugin version 4.0 or earlier (and other build systems)
As part of the build process, the Android Gradle plugin keeps a copy of the unstripped libraries in a project directory. This directory structure is similar to the following:
app/build/intermediates/cmake/universal/release/obj/
├── armeabi-v7a/
│ ├── libgameengine.so
│ ├── libothercode.so
│ └── libvideocodec.so
├── arm64-v8a/
│ ├── libgameengine.so
│ ├── libothercode.so
│ └── libvideocodec.so
├── x86/
│ ├── libgameengine.so
│ ├── libothercode.so
│ └── libvideocodec.so
└── x86_64/
├── libgameengine.so
├── libothercode.so
└── libvideocodec.so
Zip up the contents of this directory:
cd app/build/intermediates/cmake/universal/release/obj zip -r symbols.zip .Manually upload the
symbols.zipfile to the Google Play Console.