I'm using R8 to minimize my library, and the companion object's methods aren't being picked up as references of the main class. The companion and the methods still exist, I just can't call them without referencing the companion object.
// Works
MyClass.Companion.foo()
// Errors with an unresolved reference.
MyClass.foo(this)
My proguard rules:
-keep @interface kotlin.Metadata { *; }
-keepattributes RuntimeVisibleAnnotations
-keep public class com.example.MyClass {
public <methods>;
public static <methods>;
}
-keep public class com.example.MyClass$Companion {
public <methods>;
}
The companion methods are also labeled @JvmStatic, and those static methods exist in the generated code, but the kotlin compiler doesn't recognize those either.
This is due to your models getting obfuscated when minify is enabled. To fix add the path to your models package to your Proguard rules.
Something like this should work: