Open
Description
Bit of an edge case here—but if all of the functions in a Retrofit interface are unused, R8 will strip them. This causes the following Proguard rule to miss:
Then once you try to instantiate the stripped service class, you get a fairly nondescript ClassCastException
from Retrofit. E.g.:
Caused by: java.lang.ClassCastException
at androidx.appcompat.app.ToolbarActionBar$$ExternalSyntheticThrowCCEIfNotNull0.m(:0)
Replacing the referenced rule with the following one fixes the issue for us:
-if interface *
-keepclasseswithmembers,allowobfuscation interface <1> {
@retrofit2.http.* <methods>;
}
(Source: here)
Note: I barely know how to proguard, so this definitely requires some scrutiny. Raising issue here for visibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels