Did you also receive a warning when uploading your AAB to the Google Play Store, that it's missing native debug symbols? Let's have a look at what this means, and what you can do about it!

play store warning

Catching bugs on the Play Store

The Play Store collects and reports bugs when your app crashes. While we do advice to use a dedicated bug tracking tool like Sentry, it's nice to make the best of this tool to.

So when your app crashes, and the user reports the crash, the stack trace is sent to the Play Store. The crash can potentially come from:

  • Javascript code
  • Java/Kotlin code
  • Native code (C++)

To visualise this crash, the Play Store needs access to debug symbols so that it can show where in your code it occurred. Let's have a look:

Javascript

The Google Play store doens't map collected information from the minified bundle, to the original source code, so it's hard to reason about. Sentry has excellent support for this.

Java/Kotlin code

As you use Proguard, to obfuscate the code, the stack trace won't make a lot of sense. The Play Store needs your proguard mapping file, so that it can map the obfuscated functions/classess back to their original names and display a nice error.

The good part: since we all use the AAB format by now, this Android App Bundle already contains this, and you don't really need to do anything.

Native Code

If you want to run C or C++ in an Android app, you can use the Android NDK. This allows to reuse code on iOS or Android and is preffered by popular libraries like Reanimated 2 and also heavily used by React Native.

Following Google's steps

On the Google support website there is an excellent guide on how to include these native debug symbols in your app. Let's go ahead!

  1. Add android.buildTypes.release.ndk.debugSymbolLevel = 'FULL' to your android/app/build.gradle
  2. Make a new app bundle (./gradlew bundleRelease)

Under the folder android/app/build/outputs/bundle/release/, you will find app-release.aab. You can rename this folder to .zip and open the archive.

If it was successful, you will find all your native code's debug symbols under BUNDLE-METADATA/com.android.tools.debugsymbols.

the native debug symbols

However, what you may notice here is that this only contains the c++ libraries that are included with your app. The debug symbols for dependencies like React Native, or Reanimated 2, that are used in this app, are missing.

I've openened a Stack Overflow thread in the hopes a C++ export can explain.

Doing it manually

So while going through Github issues and Stack Overflow threads, I found one interesting flutter issue, where someone points out you can manually create this zip containing your native debug symbols. Let's give it a go and see if it works!

  1. Make your (release) app bundle
  2. Make a zip from android/app/build/intermediates/merged_native_libs/release/out/lib/
  3. Upload this manually to the Play Store

merged_native_libs folder

Going forward

I'm still unsure why the native libraries are missing from the AAB in the first place, and if the manual way actually works correctly. I'm currently testing this and will open a GitHub or Stack Overflow issue later on.

A note on the Android App Bundle

The AAB (Android App Bundle) doesn't only allow the Play Store to generate small APK's for every CPU architecture, it also allows including other relevant resources, like your ProGuard mapping file. These files won't end up in your APK, but the Play Store has them and will use accordingly.

Links