I'm working with android and trying to use some native code in my app.
Here is a skeleton of the application code:
package A.B;
/*
import statements
*/
public class C extends Activity{
public void onCreate(...){
....
foo();
....
}
public int foo(){
.....
data(a, b);
.....
}
public int data(a, b){
GetValues(a, b);
}
static{
System.loadLibrary("baz");
}
public native int GetValues(int[] a, int b);
}
the native method signature goes like this:
JNIEXPORT jint JNICALL
Java_A_B_C_GetValues(JNIEnv *env, jobject obj, jintArray arr, jint b){
....
....
}
while running the logcat shows up: W/dalvikvm(799): No implementation found for native LA/B/C;.GetValues ([IJ)I
the ndk documentation doesnt strictly mention creating a header file, so i dont have one
the android.mk file's contents:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := baz
LOCAL_SRC_FILES := baz.cpp
include $(BUILD_SHARED_LIBRARY)
Thanks in advance.
Since your native file is a .cpp file, I am guessing that you will need to use extern "C". Why and Why
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With