Closed AlienKevin closed 10 months ago
Cargokit doesn't strip the symbols. Symbols stripping can be configured in Cargo.toml, which is part of your project.
For example: https://github.com/superlistapp/super_native_extensions/blob/main/super_native_extensions/rust/Cargo.toml
If not stripped by cargo, the symbols might also be stripped by gradle when packaging the app
Thanks for the pointers. For future people's reference here are the two key steps you need to do:
If you wish to keep debug symbols in release mode, you have to turn on debug
in your Rust code's cargo.toml:
[profile.release]
debug = true
To keep all debug symbols on Android, you need to add the following lines to your android/app/build.gradle
:
android {
..
packagingOptions {
jniLibs.keepDebugSymbols += "**/*.so"
}
}
Note: This will keep debug symbols in both debug and release mode for all your native dependencies. You might want to specify only the .so
file for your rust library to reduce the bundle size in production. Another thing to note is that you should add this packagingOptions
in your app's build.gradle, not in the one in the rust_builder
library generated by cargokit.
Issue Summary
Using the default config of cargokit with Flutter Rust Bridge V2, I observed that the panic backtrace works well on iOS. However, when I tested on Android, I noticed that the debug symbols are redacted ass.
Issue Details
I tested the panic backtrace using backtrace-rs and sentry-rust's panic monitoring mechanism. Flutter was ran under the debug mode with no modification to cargokit's configurations. I also tested on both a real Android 10 device and a Android 14 simulator. All experiments produced the same result: full trace on iOS but redacted trace on Android. I think this maybe due to missing debug symbols for Android.
Here are the panic backtraces for iOS and Android:
iOS
Android
Proposed Changes