What can cause SIGSEGV when calling NewObjectArray for JNI on Android?

I just started working with Android NDK, but I keep getting SIGSEGV when I have this call in my C code:

jobjectArray someStringArray;
someStringArray = (*env)->NewObjectArray(env, 10, 
(*env)->FindClass(env,"java/lang/String"),(*env)->NewStringUTF(env, ""));

Based on the whole example that I can find, the above code is correct, but I keep getting SIGSERGV, and everything is fine if the NewObjectArray line is commented out. Any idea what might cause such a problem?

+5
source share
2 answers

, , - . , checkjni? : FindClass , NewStringUTF , NewObjectArray.

btw, NULL ; ( , Sun ), . ( " " [10] " Java.)

+4

, , JNI- VM - ( 512 Android).

FindClass() NewStringUTF() , JNI-, VM , . DeleteLocalRef(), , . , "" , VM , .

JNI- - , JNI.

+2

All Articles