-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support R8 FullMode #1663
Comments
Wanna send a PR? I'd want to see a full description of the implications of that rule and its attributes, but open to it! |
Currently I just copy pasta this rule from other Android library projects, e.g. this PR which also contains a nice explanation: square/retrofit#3579 I think this is also true for Moshi. But I am not really an expert on this topic. |
Well, PR welcome but would need an explanation of the side effects. We're unlikely to accept a PR with broad proguard/R8 implications without that kind of detail. |
Is this error due to moshi?
I have retrofit and moshi, just upraded to AS flamingo with AGP 8 and Java 17. This error causes retrofit calls to not happen. |
@DarkAbhi Nope, your stacktrace seems not to be related to Moshi, since it would run into this error: https://github.com/square/moshi/blob/1.14.0/moshi/src/main/java/com/squareup/moshi/AdapterMethodsFactory.java#L226 |
Right, thanks. I'm going to be running around a lot figuring this out.. |
@G00fY2 @ZacSweers Would you have any idea about this issue? |
Currently Moshi expects JsonAdapters to have the
ParameterizedType
. But the R8 fullMode (which is enabled by default since AGP8) strips signatures from non-kept items. Therefore the check in parametersAreJsonAdapters (also in the Kotlin implementation) fails because of this assumption and you run into a IllegalArgumentException at runtime.I was able to fix this by adding the following proguard rule:
-keep,allowobfuscation,allowshrinking class com.squareup.moshi.JsonAdapter
I would expect this rule as part of the META-INF/proguard/moshi.pro
The text was updated successfully, but these errors were encountered: