Search code examples
androidandroid-ndkjava-native-interfacenative

using jlongArray in JNI with Android NDK


I have those two pieces of code, the first is:

JNIEXPORT jlongArray* JNICALL Java_com_home_overlay_activity_MainActivity_ProcessPointer(JNIEnv* env, jobject) {

    jlongArray blobs_arr;

    return &blobs_arr;
}

and the second is:

JNIEXPORT jlongArray JNICALL Java_com_home_overlay_activity_MainActivity_Process(JNIEnv* env, jobject) {

    jlongArray blobs_arr;

    return blobs_arr;
}

all I want is to return long array to the java code.

The first runs okay while the second not, is there any issue here with returning a long array this way ??


Solution

  • My application was not reading the jni.h but working .. which is weird, after I set the NDKROOT variable it all worked correctly