R8 minification breaks Gson models in release build
Android release build with minifyEnabled true (R8, AGP 8.4). Debug works. Release installs but every API parse returns objects with null fields, no crash. Using Gson 2.10.1 with data classes: data class User(val id: String, val name: String). I think R8 is stripping or renaming the fields. Do I need @Keep everywhere or is there a proguard rule? No crash makes it harder to spot than you would think.
4 replies