Replies: 1 comment 1 reply
-
We use moshi's proguard rule gen directly in the KSP plugin, I'm surprised that isn't a part of that 🤔. PR welcome but check that first |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After #626, I find myself circling back to #556. Although the PR fixes the malformed generated rules, and these rules cover R8 in compat mode, turning on R8 full mode (which is the default since Gradle 8) still raises an exception:
Based on the strack trace, it seems like Moshi was unable to find the generated
MessageJsonAdapter
and ended up attempting to useMapJsonAdapter
, which obviously doesn't work.To confirm, I manually registered the
MessageJsonAdapter
:This indeed makes the crash goes away.
Looking at the (decompiled) code after minification, I noticed that the
Message
class itself is stripped of its@JsonClass
annotation when R8 full mode is enabled. Since Moshi relies on this annotation to resolve the generated adapter, that would explain why it doesn't find theMessageJsonAdapter
.Because I haven't seen this issue with adapters generated by Moshi itself, I had a quick look there. It seems that Moshi generates an additional rule for every
@JsonClass
-annotated class:Adding this rule for the
Message
sealed class, fixes the exception:Long story short: would you be happy with me opening another small PR to add this rule to
moshi-proguard-rule-gen
?Beta Was this translation helpful? Give feedback.
All reactions