Skip to content

R8 full mode and @Streaming giving runtime error with minifyEnabled #3898

Open
@Stofferoo

Description

@Stofferoo

Using Retrofit 2.9.0 and AGP 8.0.1 with fixes from #3751 I still get one more error with R8 in full mode:

E  java.lang.IllegalArgumentException: Response must include generic type (e.g., Response<String>)
     for method ContentApi.getRawFile
        at retrofit2.Utils.methodError(SourceFile:54)
        at retrofit2.Utils.methodError(SourceFile:43)
        at retrofit2.HttpServiceMethod.parseAnnotations(SourceFile:77)
        at retrofit2.ServiceMethod.parseAnnotations(SourceFile:39)
        at retrofit2.Retrofit.loadServiceMethod(SourceFile:202)
        at retrofit2.Retrofit$1.invoke(SourceFile:160)
        at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
        at $Proxy23.getRawFile(Unknown Source)
        at com.kivra.android.repository.ContentFileDownloader.downloadFile(SourceFile:40)
        at com.kivra.android.repository.ContentPartFileTransform.fetchContentFiles(SourceFile:56)
        at com.kivra.android.repository.ContentPartFileTransform.access$fetchContentFiles(SourceFile:28)
        at com.kivra.android.repository.ContentPartFileTransform$transformData$2.invokeSuspend(SourceFile:42)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:33)
        at kotlinx.coroutines.DispatchedTask.run(SourceFile:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(SourceFile:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(SourceFile:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(SourceFile:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:664)

This is how the signature looks like:

    @Streaming
    @GET("{apiVersion}/{actorType}/{actorKey}/content/{contentKey}/file/{fileKey}/raw/{fileName}")
    suspend fun getRawFile(
        @Path("apiVersion") apiVersion: String,
        @Path("actorType") actorType: String,
        @Path("actorKey") actorKey: String,
        @Path("contentKey") contentKey: String,
        @Path("fileKey") fileKey: String,
        @Path("fileName") fileName: String
    ): Response<ResponseBody>

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:

# R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>

So perhaps something is missing still from this commit: 59d302a ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions