标签:android com class img java size width log har 文件中 height
jni.c中注册中
int register_android_boa(JNIEnv *env)
{
jclass
clazz;
static const char* const kClassName =
"com/lxl/ledClass"; //命名的类
/* look up the class */
clazz =
(*env)->FindClass(env,kClassName);
// clazz =
env->FindClass(env,kClassBoa);
// clazz =
(*env)->FindClass(kClassName);
if (clazz == NULL)
{
LOGE("Can‘t find class %s\n",
kClassName);
return
-1;
}
/* register all the methods */
if
((*env)->RegisterNatives(env,clazz, gMethods, sizeof(gMethods) /
sizeof(gMethods[0])) != JNI_OK)
//if
(env->RegisterNatives(env,clazz, gMethods, sizeof(gMethods) /
sizeof(gMethods[0])) != JNI_OK)
{
LOGE("Failed registering methods
for %s\n", kClassName);
return
-1;
}
/* fill out the rest of the ID cache
*/
return 0;
}
则在JAVA工程中使用这个库时必须有com.lxl.ledClass.java这个文件
JNI文件中命名类与JAVA文件中匹配,码迷,mamicode.com
标签:android com class img java size width log har 文件中 height
原文地址:http://www.cnblogs.com/luxiaolai/p/3695246.html