Android ndk question.

Asked 2 years ago, Updated 2 years ago, 114 views

Hello. I had a question while I was practicing ndk. Usually, when you build ndk using android.mk files, you need a C language header file. That's when the method statement is

JNIEXPORT void JNICALL Java_com_msi_ibm_ndk_CameraSurfaceView_convertToGray(JNIEnv * env, jobject  obj, jobject bitmapcolor,jobject bitmapgray)

It's a bit different from the C language method. But do I have to automatically create this method with javah? For ffmpeg open source, there are too many .h files.

ndk

2022-09-22 14:58

1 Answers

Headers that are automatically generated as javah generate only the part of the function declared native in the Java source code you are developing.

Traditional C sources (such as open sources) can be used as they are (just set the source and library path well), and a few simple settings (Note) in Android Studio (or IDE such as Eclipse).

And if you know the C language response rule for functions in Java (how to define JNI functions), you don't have to use javah. However, it is recommended to use automatic generation because it reduces the possibility of errors (human errors).

Use javah again when:

Please refer to this article.


2022-09-22 14:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.