Open ngarelimdex opened 6 years ago
-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}
should keep the @Json
on the parameter, so I'm not sure.
Can you check in your dex file? Is there anything else in the build chain that might not be applying these ProGuard rules?
Do you mind if I send you the sample app? It would be easier this way.
Feel free to link to a sample app.
I have setup a repo here: https://gitlab.com/nicolas-garel/sampleMoshi
Just wondering if there is any update on this issue?
I'm seeing a similar issue here: https://github.com/square/moshi/issues/454. Is there any update?
is there any update?
Still doesn't work even including the ProGuard rules of the README file. Please do you have a fix for this?
@fgarcialainez can you link a minimal reproducible sample for the issue and more details? "doesn't work" doesn't give us enough context to help :)
Yes, sorry... Something as simple as this.
public enum MyEnum { @Json(name = "option_1") OPTION1, @Json(name = "option_2") OPTION2 }
On parsing this enum included in any Java class the application is crashing.
Thanks and Regards,
Please link a sample project with a case we can run to reproduce. Since there's an implication of proguard rules impacting this it's best to see a full integration
Hi,
I don't have a sample project that I can link, but I think that this use case is really simple to reproduce.
Regards,
@fgarcialainez If it's really simple to reproduce, could you please do so in a project and upload it to GitHub? Thanks!
i had this problem with moshi version 1.8.0 while using kotlin.
simple fix was using
@field:Json(name = "start-over") val startOver: Boolean
instead of
@Json(name = "start-over") val startOver: Boolean
I have made a simple app with just the following:
And here are my proguard rules:
I'm using:
and kotlin 1.1.51
The problem is that i get dummy = 0 when I use "dummy1" in the Json annotation. I get 1 if I use "dummy". In other words it doesn't work if the variable does not match json key.