UnsatisfiedLinkError in companion object Kotlin JNI

后端 未结 1 653
广开言路
广开言路 2021-01-26 19:05

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

相关标签:
1条回答
  • 2021-01-26 19:31

    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.

    0 讨论(0)
提交回复
热议问题