I am using Android R8 obfuscation in my Android library.
After including the AAR file in the application module of the library's client project, I am getting compile time errors for interfaces that are declared inside the class or another interface.
e.g. one of the public interfaces is MyPublicInterface:
interface InterfaceA {
fun a()
}
interface InterfaceB {
fun b()
}
class ClassA {
interface NestedInterfaceOfA {
fun nia()
}
}
interface MyPublicInterface : InterfaceA, InterfaceB, ClassA.NestedInterfaceOfA
The interface MyPublicInterface
is used by the application module.
I am getting the below errors while compiling the application module:
"Cannot access ClassA$NestedInterfaceOfA which is a supertype of MyPublicInterface. Please make sure you have the required dependencies in the classpath."
"unresolved supertypes ClassA$NestedInterfaceOfA"
I tried all the below rules:
-keepclasseswithmembers public interface * {
*;
}
-keepclasseswithmembernames public interface * {
*;
}
-keep public interface *$* {
*;
}
-keepclasseswithmembers public interface *$* {
*;
}
-keepclasseswithmembernames public interface *$* {
*;
}
-keepattributes InnerClasses, Signature
I tried by explicitly adding @Keep annotation in code and by explicitly adding the keep rule for a particular interface as well. But it didn't work.
Note: The entire code of the library is in Kotlin.