[英]Calling Kotlin function from java results in java.lang.NoClassDefFoundError: kotlin/TypeCastException (String Arrays)
I have a Kotlin function that returns a String array that looks something like:我有一个 Kotlin function 返回一个字符串数组,它看起来像:
fun getStringArrayFunction(): Array<String> {
return objectList.map { it.StringField }.toTypedArray()
}
I import the library and call this function from java:我导入库并从 java 调用这个 function:
String[] myStringArray = getStringArrayFunction();
As mentioned in the title, I get the TypeCastException.如标题中所述,我得到了 TypeCastException。 Am I missing something?我错过了什么吗?
Thanks!谢谢!
Per @CodeScale, I needed to import the kotlin standard library.根据@CodeScale,我需要导入 kotlin 标准库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.