We are seeing some crashes in Proguard optimized builds which we believe stem from GSON optimizations that were recently introduced.
The crashes look like this (obfuscated trace):
E/AndroidRuntime: FATAL EXCEPTION: main
Process: <process name>, PID: <pid>
java.lang.IllegalAccessError: Final field 'atm.a' cannot be written to by method 'java.lang.Object atg.read(arn)' (declaration of 'atg' appears in <apk name>)
Where "atm" is a class being deserialized from JSON using GSON, and "atg" is the Proguard-generated class.
This happens when we do a straightforward gson.fromJson(str, atm.class).
The reason is that the serialized class contains a final field, perhaps because it's only ever set in the ctor. This works fine with plain GSON but the Proguard-generated deserializer throws at runtime. Since it only happens with optimizations turned on and does not cause any warnings when compiling, it was a difficult one to debug. Indeed, making the fields not final raises linter warnings ("FieldMayBeFinal").
Expected behavior: Either make sure Proguard can optimize for this case, or raise a build-time error when it's encountered, or disable optimization for classes with final fields.
Thanks for your report and sorry about the delay. It sounds like a straightforward issue -- we're looking at it.