You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter中如何符号化libapp.so堆栈跟踪信息?

How to symbolize libapp.so stack traces for Flutter crashes in Google Play Console?

I sometimes see crash reports like this in Google Play Console:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.blackoutage.game <<<
backtrace:
#00 pc 00000000003080f0 /data/app/~~X6gyE3SkREkb9PZZqeHzjA==/com.blackoutage.game-7OdYWe4UMLRMee8enANExA==/split_config.arm64_v8a.apk!lib/arm64-v8a/libflutter.so (offset 0xafa000)
#00 pc 0000000000306ad4 /data/app/~~X6gyE3SkREkb9PZZqeHzjA==/com.blackoutage.game-7OdYWe4UMLRMee8enANExA==/split_config.arm64_v8a.apk!lib/arm64-v8a/libflutter.so (offset 0xafa000)
#00 pc 000000000065ebc4 /data/app/~~X6gyE3SkREkb9PZZqeHzjA==/com.blackoutage.game-7OdYWe4UMLRMee8enANExA==/split_config.arm64_v8a.apk!lib/arm64-v8a/libflutter.so (offset 0xafa000)
#00 pc 000000000051e4a8 /data/app/~~X6gyE3SkREkb9PZZqeHzjA==/com.blackoutage.game-7OdYWe4UMLRMee8enANExA==/split_config.arm64_v8a.apk!lib/arm64-v8a/libapp.so (offset 0x1000)
#00 pc 0000000000565c9c /data/app/~~X6gyE3SkREkb9PZZqeHzjA==/com.blackoutage.game-7OdYWe4UMLRMee8enANExA==/split_config.arm64_v8a.apk!lib/arm64-v8a/libapp.so (offset 0x1000)
#00 pc 000000000063925c /data/app/~~X6gyE3SkREkb9PZZqeHzjA==/com.blackoutage.game-7OdYWe4UMLRMee8enANExA==/split_config.arm64_v8a.apk!lib/arm64-v8a/libflutter.so (offset 0xafa000)
#00 pc b4000071fdfd5200 <unknown>

Symbolizing the libflutter.so stack traces is relatively straightforward, but to fix these crashes, I need to symbolize the libapp.so parts of the stack trace. How do I do that?


Solution: Symbolizing libapp.so Stack Traces

Great question! Symbolizing libapp.so traces is key to pinpointing exactly where your Flutter app is crashing, and it's totally doable with the right steps. Here's how to do it:

Step 1: Locate the Debug Symbols for libapp.so

When you build your Flutter app for release (especially when uploading to Google Play), Flutter generates debug symbols for libapp.so alongside your APK/AAB. These are usually stored in:

  • For APKs: Check the build directory, typically build/app/outputs/apk/release/ – you'll find files like app-arm64-v8a-release.symbols.zip (match the architecture from your crash log, which is arm64-v8a here).
  • For App Bundles (AAB): The symbols are included in the bundle itself, or you can find them in build/app/outputs/bundle/release/app-release.symbols.zip.

If you don't have these files locally, you can download them directly from Google Play Console:

  1. Go to the App bundle explorer for your app.
  2. Select the app version that matches the crash report's version.
  3. Under Downloads, look for Debug symbols and grab the zip file for the correct architecture.

Step 2: Extract the Symbols

Unzip the symbols file you found. Inside, you'll get a lib/arm64-v8a/libapp.so file (again, matching your crash's architecture) – this is the symbolized version of the library you need.

Step 3: Use addr2line to Decode Stack Frames

addr2line is a tool included in the Android NDK (find it in your NDK directory, usually under toolchains/llvm/prebuilt/<your-host-os>/bin/aarch64-linux-android-addr2line for arm64-v8a).

For each libapp.so line in your crash log, calculate the correct address to pass to addr2line:

  • Take the PC address from the log (e.g., 000000000051e4a8)
  • Add the offset listed in the log (e.g., 0x1000)
  • The final address is 0x51e4a8 + 0x1000 = 0x52e4a8

Run this command for each calculated address:

aarch64-linux-android-addr2line -f -C -e /path/to/extracted/libapp.so 0x52e4a8
  • -f: Shows the function name
  • -C: Demangles C++ function names (critical for reading Flutter/Dart code traces)
  • -e: Specifies the path to your symbolized libapp.so

Repeat this for every libapp.so line in your backtrace, and you'll get human-readable function names and file locations where the crash occurred.

Step 4: Automate (Optional)

If you have multiple crash logs to process, write a simple script to parse the backtrace, extract libapp.so lines, calculate addresses, and run addr2line automatically. This saves a ton of time compared to manual processing.

Bonus: Enable Automatic Symbol Upload

To avoid manual symbolization in the future, configure your Flutter build to auto-upload debug symbols to Google Play Console:

  1. For App Bundles, Flutter does this by default when you use flutter build appbundle and upload via flutter upload or the Play Console UI.
  2. For APKs, add this to your android/app/build.gradle:
    android {
        buildTypes {
            release {
                ndk {
                    debugSymbolLevel 'FULL'
                }
            }
        }
    }
    
    When uploading the APK, make sure to include the symbols zip file (Google Play Console will prompt you if it's missing).

内容的提问来源于stack exchange,提问作者raver

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 16:47:32