1、AS2.0
D:androidMyWorkSmartCamappuildintermediatesclassesdebug>javap -s com.admin.smartcam.javatoc.JavaToC Compiled from "JavaToC.java" public class com.admin.smartcam.javatoc.JavaToC { public com.admin.smartcam.javatoc.JavaToC(); descriptor: ()V //这就是签名 public native boolean FaceDetecter(byte[]); descriptor: ([B)Z //这就是签名 } D:androidMyWorkSmartCamappuildintermediatesclassesdebug>com.admin.smartcam.javatoc.JavaToC
2、要先编译一下,生成对应的Class文件,才能签名
3、C调用java步骤:
//C调用JAVA //1、得到字节码 char *string = "com/admin/smartcam/javatoc/JavaToC";//字节码 要调用的java类的全类名 jclass jclazz = (*env)->FindClass(env, string);//com.admin.smartcam.javatoc.JavaToC //2、得到对应的方法 jmethodID jID=(*env)->GetMethodID(env,jclazz,"JavaloveC", "()V");//第四个参数为方法签名 //3、实例化JNI // 类 jobject jobj=(*env)->AllocObject(env,jclazz); //4、调用方法 (*env)->CallVoidMethod(env,jobj,jID);
4、ok,谢谢!