我目前正在使用Kotlin-reflect制作模块。当我尝试将二进制文件构建为发布模式时,没有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