Hi i have a strange runtime exception in my androi...
# arrow
t
Hi i have a strange runtime exception in my android application i employ arrow retrofit call adapter and can successfully build a release build using proguard which is available on the google play store. that production version of my application employs AGP 7.4.2
i am attempting to upgrade to AGP 8.2.0-alpha07 and now my application release build fails with the following runtime exception
Copy code
java.lang.IllegalArgumentException: Unable to create call adapter for retrofit2.Call<wh3>
     for method MyApplicationServiceApi.siteUserLogin
    at retrofit2.Utils.methodError(SourceFile:5)
    at retrofit2.HttpServiceMethod.createCallAdapter(Unknown Source:12)
    at retrofit2.HttpServiceMethod.parseAnnotations(Unknown Source:67)
    at retrofit2.ServiceMethod.parseAnnotations(Unknown Source:18)
    at retrofit2.Retrofit.loadServiceMethod(Unknown Source:24)
    at retrofit2.Retrofit$1.invoke(Unknown Source:37)
    at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    at $Proxy2.siteUserLogin(Unknown Source)
    at m03.siteUserLogin(Unknown Source:2)
    at k03$k.invokeSuspend(Unknown Source:47)
    at kl.resumeWith(Unknown Source:11)
    at mk0.run(Unknown Source:123)
    at f42$a.run(Unknown Source:3)
    at fb4.run(Unknown Source:2)
    at oa0.J(Unknown Source:0)
    at oa0$c.d(Unknown Source:14)
    at oa0$c.p(Unknown Source:28)
    at oa0$c.run(Unknown Source:0)
    Suppressed: mj0: [androidx.compose.ui.platform.s@839caba, ro@23c2d6b, z24{Cancelling}@53820c8, n@5931561]
 Caused by: java.lang.IllegalArgumentException: Return type must be parameterized as Call<wh3><ErrorBody, ResponseBody> or Call<wh3><out ErrorBody, out ResponseBody>
    at ep0.a(Unknown Source:194)
    at ep0.get(Unknown Source:33)
    at retrofit2.Retrofit.nextCallAdapter(Unknown Source:35)
    at retrofit2.Retrofit.callAdapter(Unknown Source:1)
    at retrofit2.HttpServiceMethod.createCallAdapter(Unknown Source:0)
    ... 16 more
my retrofit calls employ arrow retrofit call adapter _api_(platform("io.arrow-ktarrow stack1.2.0-RC")) _api_("io.arrow-kt:arrow-core") _api_("io.arrow-kt:arrow-core-retrofit")
i would really appreciate some help in identifying why my application now crashes due to upgrade in AGP version
s
I think it's related to this. https://github.com/arrow-kt/arrow-integrations/issues/121 cc\\ @Stylianos Gakis
s
Yeah it may be the same issue, I don’t remember the error message exactly. What you can do is look at the PR that I linked in that issue here https://github.com/HedvigInsurance/android/pull/1529 and look in the changes I’ve done in the proguard-rules.pro and see if that works for you too.
t
i fixed it by adding all this to my proguard
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-keep,allowobfuscation,allowshrinking class arrow.core.**
-keep,allowobfuscation,allowshrinking class arrow.retrofit.**
i am now experimenting to see if i can remove or amend any of these entries and still run crash free 😄
s
Perfect!
t
I managed to obtain a crash free config only using these two additional entries
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-keep,allowobfuscation,allowshrinking class arrow.retrofit.**
760 Views