Как установить прогуард для Kotlin-рефлекса? - PullRequest
0 голосов
/ 16 ноября 2018

В настоящее время я делаю модуль с использованием Kotlin-рефлекса.Когда я пытаюсь создать бинарный файл как режим выпуска, ошибки proguard не возникает, но модуль не работает.

instance::class.memberProperties.forEach {

    val name = it.annotations.find { annotation -> annotation is Property}
        ?.let { property -> (property as Property).name }
        ?:it.name

    attributeMap[name].let { value ->

        if (value != null && (it is KMutableProperty<*>)) {
            // Log message is not printed after this line.
            it.setter.call(instance, value)
        } else if (value == null) {
            propertyNameMap[it.name] = name
        }
    }
}

Я бы установил файл proguard-rules.pro следующим образом.(https://github.com/square/moshi/issues/402)

-keep interface kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoader
-keep class kotlin.reflect.jvm.internal.impl.serialization.deserialization.builtins.BuiltInsLoaderImpl
...