我正在我的一个移动应用程序中将代码从 Java 转换为 Kotlin,而在 Java 中运行的代码在 Kotlin 中停止运行。它使用 JNI 桥来调用 C++ 代码。
Kotlin 方法声明:
class Converter{
companion object {
external fun convertNative(width: Int, height: Int, row: Int, input: ByteArray, ft: Int, output: ByteArray)
}
}
Run Code Online (Sandbox Code Playgroud)
.cc 代码:
extern "C" {
JNIEXPORT void JNICALL OBJECT_TRACKER_METHOD(convertNative)(JNIEnv* env, jobject thiz, jint width, jint height, jint row,
jbyteArray input, jint ft, jbyteArray output);
}
JNIEXPORT void JNICALL OBJECT_TRACKER_METHOD(convertNative)(
JNIEnv* env, jobject thiz, jint width, jint height, jint row,
jbyteArray input, jint ft, jbyteArray output) …Run Code Online (Sandbox Code Playgroud)