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 object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
I have the header file for this library:
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#define LIB_API(type) __declspec(dllexport) type
#else
#define LIB_API(type) type
#endif
LIB_API(int) module_init();
#ifdef __cplusplus
}
#endif
The problem is the exception when I try and call the function from my Android App:
D/dalvikvm﹕ Added shared lib /data/app-lib/com.sunsystems.snaptest-1/libapp_module.so 0x416f3d88
D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.sunsystems.snaptest-1/libapp_module.so 0x416f3d88, skipping init
W/dalvikvm﹕ No implementation found for native Lcom/sunsystems/snaptest/App_Module;.module_init:()I
UnsatisfiedLinkError: Native method not found: com.sunsystems.snaptest.App_Module.module_init:()I
This is what I am doing
I have created a Android App and I want to call that module_init() from my App so I have created a class called App_Module.java
public class App_Module {
/* Load native C libraries */
static {
System.loadLibrary("app_module");
}
public native static int module_init();
}
And I used JNI like this in my root of the project:
javah -jni -classpath build/classes/debug -d jni/ com.sunsystems.snaptest.App_Module
Which generated the following header interface:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_sunsystems_snaptest_App_Module */
#ifndef _Included_com_sunsystems_snaptest_App_Module
#define _Included_com_sunsystems_snaptest_App_Module
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_sunsystems_snaptest_App_Module
* Method: module_init
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_sunsystems_snaptest_App_Module_module_1init
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif
Then in my Android App I load the library in the above App_Module class and call it like this:
App_Module.module_init()
So I guess it cannot find symbol inside the libapp_module.so library.
Many thanks for any suggestions,
java.lang.UnsatisfiedLinkError: module_init. Can u help me solve problem?