Hello,
I having an issue with proguard and kotlin reflect. without proguard everything is fine but when proguard obfuscate class name the Kotlin meta still contain the original class name. so during an reflection call kotlin try to Deserilize class descriptor crashes fails with unresolved class at runtime. one workaround is ask proguard to keep the entire hierarchy classes/interfaces . is there any other solution than this? PFB a poc code
Activity
package ae.eres.android.kotlinserilizereflect
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import kotlin.reflect.KMutableProperty
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
button.setOnClickListener() {
val target = FooOne()
DerpMethod(target::name, "bar")
println(target.name)
}
}
}
interface FooFace {
fun fooMe(): String
}
class FooOne : FooFace {
override fun fooMe(): String = " foo"
var name = “Derpina”
}
fun DerpMethod(prop: KMutableProperty<*>, value: CharSequence) {
prop.setter.call(value)
}
proguard config
-keep class kotlin.Metadata { ; }
-keep class kotlin.* { ; }
-keep class org.jetbrains.* { *; }
-keep class ae.eres.android.kotlinserilizereflect.FooOne { *; }
Thank you