https://kotlinlang.org logo
#arrow
Title
# arrow
j

Javi Chaqués

03/23/2023, 5:38 PM
Hi, I'm having trouble using EitherCallAdapterFactory when minifying. Do I have to add any extra R8/Proguard rules?
Copy code
@POST("API URL")
    suspend fun signIn(
        @Body request: SignInApiRequest,
    ): Either<CallError, SimpleCallApiResponse<SignInApiResponse>>
s

stojan

03/23/2023, 5:59 PM
Doesn't seem like a proguard issue. Looks like the extra generic (SimpleApiResponse) is the issue
AFIK it doesn't need extra rules other than whatever retrofit requires
j

Javi Chaqués

03/23/2023, 6:30 PM
Copy code
@Serializable
data class SimpleCallApiResponse<T>(
    @SerialName("data") val data: T,
)
Copy code
@Serializable
data class SignInApiResponse(
    @SerialName("accessToken") val accessToken: String,
    @SerialName("refreshToken") val refreshToken: String,
)
if I remove Either from response, it's work correctly
s

stojan

03/23/2023, 6:37 PM
Could you try the other way, creating a specific type (without generics) for the response
j

Javi Chaqués

03/23/2023, 6:42 PM
I have the same problem with this response
Copy code
@Serializable
data class TestResponse(
    @SerialName("data") val data: SignInApiResponse,
)
it's working if i add this rule
Copy code
-keep class arrow.core.Either** {*;}
s

stojan

03/24/2023, 8:39 AM
hm... that's strange.... the adapter doesn't use reflection AFIK
19 Views