JNI的一个未解问题

1.jar
package com.tcl.os.system;
public class InputDevice {
static {
System.loadLibrary("inputproc_jni");
}
//static private native int changesinglemod(int a);
static private native int input_event_in(String a);
static public int injectEvent(String ev){
return input_event_in(ev);
}


}


2.jni
static JNINativeMethod gMethods[] = {
  //{"changesinglemod", "(I)I", (void *)com_tcl_common_Inputproc_changesinglemod},
  {"input_event_in", "(Ljava/lang/String;)I", (void *)com_tcl_common_Inputproc_input_event_in},
};


3.测试用例
//jni
import com.tcl.os.system.InputDevice;
//end
//jni
private Inputproc test = null;
//end
//jni
test = new Inputproc();
//end
放通{"changesinglemod", "(I)I", (void *)com_tcl_common_Inputproc_changesinglemod},
会提示找不到:
E/dalvikvm(14190): ERROR: couldn't find native method
E/dalvikvm(14190): Requested: Lcom/tcl/os/system/InputDevice;.changesinglemod:(I)I


难道是JNI的bug?

你可能感兴趣的:(JNI的一个未解问题)