zoukankan      html  css  js  c++  java
  • JNI文件中命名类与JAVA文件中匹配

    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 ", 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 ", kClassName);
            return -1;
        }

        /* fill out the rest of the ID cache */
        return 0;
    }

    则在JAVA工程中使用这个库时必须有com.lxl.ledClass.java这个文件

  • 相关阅读:
    preprocessing
    hist
    RabbitMQ
    线程池
    springmvc功能以及源码实现分析
    西瓜书第二章--模型评估与选择
    西瓜书第一章--绪论
    基于python的递归简述
    python小白学习之旅5
    python小白学习之旅4
  • 原文地址:https://www.cnblogs.com/luxiaolai/p/3695246.html
Copyright © 2011-2022 走看看