You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrade to AGP 8, moshi started throwing throwing
java.lang.IllegalArgumentException: Unexpected signature for public final com.cmcmarkets.mobile.android.invest.data.api.model.OrderStatusResponseDTO com.cmcmarkets.mobile.android.invest.data.api.adapters.OrderStatusResponseDTOAdapter.fromJson(com.squareup.moshi.JsonReader,com.squareup.moshi.JsonAdapter,com.squareup.moshi.JsonAdapter).
@FromJson method signatures may have one of the following structures:
<any access modifier> R fromJson(JsonReader jsonReader) throws <any>;
<any access modifier> R fromJson(JsonReader jsonReader, JsonAdapter<any> delegate, <any more delegates>) throws <any>;
<any access modifier> R fromJson(T value) throws <any>;
I've added additional proguard rules but that didn't help
# R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
-keep class com.cmcmarkets.mobile.android.invest.data.api.model.OrderStatusResponseDTO
-keepclassmembers class com.cmcmarkets.mobile.android.invest.data.api.model.OrderStatusResponseDTO {
*;
}
OrderStatusResponseDTO is sealed class
The text was updated successfully, but these errors were encountered:
Each version of AGP comes with a newer version of R8 that can add optimizations or enable new functionality. In AGP 8 I believe R8's full mode became the default. Thus, you may need to add new shrinker rules to ensure functions which are accessed via reflection (as Moshi does) are retained.
If you aren't able to figure it out based on the other reply's link, I would suggest asking on Moshi's discussions or StackOverflow using the 'moshi' tag.
Retrofit is the one asking Moshi to deserialize the body, but otherwise Moshi is a black box to Retrofit. We ask it to deserialize the bytes to a type and then wait for it to return. What Moshi does internally is entirely a Moshi thing. Or, put another way, if you manually asked Moshi to deserialize a string or bytes into that same type directly you would experience the same problem. Thus, there's really nothing that Retrofit can do here aside from try to point you to the right place to get help with Moshi.
After upgrade to AGP 8, moshi started throwing throwing
I've added additional proguard rules but that didn't help
OrderStatusResponseDTO
is sealed classThe text was updated successfully, but these errors were encountered: