#4295·retrofit

Interface without any methods not handled by Retrofit consumer keep rules

Author: sgjesseCreated Jan 27, 2025Updated Jul 16, 2026

A question from the R8 team. We recently handled https://issuetracker.google.com/391260908, which turned out to be an interface passed to create in Retrofit, which needed to be kept. The consumer keep rules already have rules to keep Retrofit interfaces, https://github.com/square/retrofit/blob/trunk/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro#L31, says

-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

However, in the case of the issue the interface had no methods (and then trivially no methods annotated with a retrofit2.http.* annotation).

Is an interface without any methods a relevant use case for Retrofit create?