i’m trying to integrate our Android app with an sd...
# reflect
j
i’m trying to integrate our Android app with an sdk which uses reflection to determine which methods of a callback interface have been implemented, i.e.,
Copy code
private fun getClientMetadata(callback: EventListener?) = ClientMetadata(
    Build.VERSION.SDK_INT,
    Build.MANUFACTURER,
    Build.MODEL,
    Build.PRODUCT,
    Build.DEVICE,
    Build.HARDWARE,
    callback != null && overridesMethod(callback::class, "onLogin"),
    callback != null && overridesMethod(callback::class, "onSuccess"),
    callback != null && overridesMethod(callback::class, "onError"),
    callback != null && overridesMethod(callback::class, "onExit"),
    callback != null && overridesMethod(callback::class, "onEvent"),
)

private fun getUnixTimestamp(): Long {
    return System.currentTimeMillis()
}

private fun overridesMethod(cls: KClass<out EventListener>, methodName: String): Boolean {
    return cls.memberFunctions.first { it.name == methodName } in cls.declaredFunctions
}
and i’m getting the following crash:
e
wow, that seems like an absurd thing for an Android SDK to do - doesn't play well with proguard/r8
doesn't look like they ship any consumer proguard rules to keep it working, either