> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/help-center/help-topics/data-api-sdk/mobile-sdk-setup-permissions-and-crashes/android-release-proguard-r8-keep-rules.md).

# Why does the Flutter SDK fail in release but work in debug?

Code that works in debug but fails in Android release builds means R8 minification (disabled in debug) is stripping or renaming SDK classes.

Code that works in debug but fails in Android release builds means **R8 minification (disabled in debug) is stripping or renaming SDK classes**. Add app-level ProGuard/R8 keep rules for the relevant Terra package and reference your `proguard-rules.pro` in the release `buildType`:

* Standard SDK: `-keep class co.tryterra.** { *; }`
* Real-time SDK: `-keep class co.tryterra.terrartandroid.** { *; }`

Gson 'abstract class can't be instantiated' crashes with obfuscated class names occur because Gson instantiates Terra model classes via reflection. Add the keep rule plus `-keepattributes Signature` and `Annotation`.

If you still see obfuscated names, your `proguard-rules.pro` is not being picked up:

* Confirm the release `buildType` references it.
* With Expo/EAS, run prebuild so `android/app/proguard-rules.pro` is applied.

If you use the direct Samsung Health integration, also keep Samsung's classes: `-keep class com.samsung.android.** { *; }`. Alternatively, disable minification for the release build. See the [Android setup docs](https://docs.tryterra.co/health-and-fitness-api/mobile-only-sources/android-kotlin) for more.
