Skip to content Skip to sidebar Skip to footer

Call C From Android Using Jni With Only A C Shared Library And Header File

Android Studio 0.3.1 Hello, I have the following library written in C but don't have the source code for it only the libapp_module.so libapp_module.so: ELF 32-bit LSB shared objec

Solution 1:

You have to implement the native method and make it call the function in your library. For example:

#include"header_file_for_your_library.h"#include"com_sunsystems_snaptest_App_Module.h"JNIEXPORT jint JNICALL Java_com_sunsystems_snaptest_App_Module_module_1init(JNIEnv *env, jclass klass){
    returnmodule_init();
}

Just about any tutorial on JNI or Android NDK will have further details.

Post a Comment for "Call C From Android Using Jni With Only A C Shared Library And Header File"