Open Stofferoo opened 1 year ago
That commit is not in the released version. Copy it into your project shrinker config and it should work until the next version is released.
Ah sorry! I was meaning to say I added that bit locally and it did not fix this issue
Keeping the replaced rules and adding the new ones from the commit https://github.com/square/retrofit/commit/59d302aedce5edae4806efac57b630d4fe8c27db fixed the issue for me.
# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
# R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
I have same problem when update AndroidStudio Flamingo & Gradle8.0.2
When i call a post method, crash:
java.lang.IllegalArgumentException: Unable to create call adapter for interface w4.d
But i solve this, add "retrofit/src/main/resources/META-INF/proguard/retrofit2.pro" all code into my proguard-rules.pro file
Maybe we can wait for retrofit2 update new version to solve this problem totally.
I am facing a similar issue with @Streaming
annotated functions, not really a crash but just the app loading forever (only on minified builds).
What is interesting to point out is:
minifyEnbaled = false
)minifyEnbaled = true
). Note: Tried both fullR8Support enabled and disabled.minifyEnbaled = true
) if I add the HttpLoggingInterceptor
Finally, I have 2 very similar interfaces that are @Streaming
annotated, and one works while the other doesn't (on signed builds with minifyEnbaled = true
).
The working one is something like
@Streaming
@GET
suspend fun downloadFile(@Url fileUrl: String): ResponseBody
The non-working one is something like:
@Streaming
@GET("api/{${MY_ID}}/bob")
suspend fun downloadDocument(@Path(MY_ID) myId: String, @Query(TYPE) type: String): ResponseBody
The only difference I can spot between the two is the different types of params added?
Update: removing the @Streaming
tag solves the issue 🤔 Although that could be explained by the network protocol not supporting it, it still doesn't explain why it works on debug builds or with the logging interceptor 😅
Using Retrofit 2.9.0 and AGP 8.0.1 with fixes from https://github.com/square/retrofit/issues/3751 I still get one more error with R8 in full mode:
This is how the signature looks like:
My best guess is that is getting stripped away but I don't know how to configure to not remove it. I thought this would have done it but apparently not:
So perhaps something is missing still from this commit: https://github.com/square/retrofit/commit/59d302aedce5edae4806efac57b630d4fe8c27db ?