班级:
package com.example.foo;
public class Dummy
{
int value;
public Dummy(int value)
{
this.value = value;
}
}
JNI 片段:
jclass class = (*jni_env)->FindClass(jni_env, "com/example/foo/Dummy");
jmethodID constructor = (*jni_env)->GetMethodID(jni_env, class, "<init>", "(I)V");
jobject object = (*jni_env)->NewObject(jni_env, constructor, 0);
LogCat 输出:
09-03 11:02:02.937: W/dalvikvm(2179): Invalid indirect reference 0x44e9cf80 in decodeIndirectRef
09-03 11:02:02.937: E/dalvikvm(2179): VM aborting
09-03 11:02:02.937: A/libc(2179): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 2179