I\'m converting code from Java to Kotlin in one of my mobile apps, and the code that worked in Java stopped working in Kotlin. It uses JNI bridge to call C++ code.
Kotli
If you want to avoid changing the C++ code you should annotate the Kotlin function with @JvmStatic
, i.e:
@JvmStatic external fun convertNative(width: Int, height: Int, row: Int, input: ByteArray, ft: Int, output: ByteArray)
By the way, your C++ function declaration is technically incorrect: For static methods, the second parameter is a jclass
, not a jobject
.