zoukankan      html  css  js  c++  java
  • Android error--No implementation found for native Lcomd

           在利用NDK编译Cpp执行时,出现了No implementation found for native Lcom等错误,调试好久,才发现

    XXX.h和XXX.cpp。在XXX.cpp里#include XXX.h。竟然出现了No implementation found for native Lcom。

    然后,XXX.h删除。所有在XXX.cpp里实现,居然通过了。

           NDK是不能直接include 编译(javah)出来的XXX.h。假设真要包括至少要删减一些语句。

    当然,能够include 其它.h文件。

    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class com_ndk_test_JniClient */
    
    //#ifndef _Included_com_ndk_test_JniClient
    //#define _Included_com_ndk_test_JniClient
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
     * Class:     com_ndk_test_JniClient
     * Method:    AddStr
     * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
     */
    JNIEXPORT jstring JNICALL Java_com_ndk_test_JniClient_AddStr
      (JNIEnv *, jclass, jstring, jstring);
    
    /*
     * Class:     com_ndk_test_JniClient
     * Method:    AddInt
     * Signature: (II)I
     */
    JNIEXPORT jint JNICALL Java_com_ndk_test_JniClient_AddInt
      (JNIEnv *, jclass, jint, jint);
    
    #ifdef __cplusplus
    }
    #endif
    //#endif
    


    #include "com_ndk_test_JniClient.h"
    #include <stdlib.h>
    #include <stdio.h>
    #ifdef __cplusplus   
    extern "C"  
    {   
    #endif  
    /*
     * Class:     com_ndk_test_JniClient
     * Method:    AddStr
     * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
     */
    JNIEXPORT jstring JNICALL Java_com_ndk_test_JniClient_AddStr
      (JNIEnv *env, jclass arg, jstring instringA, jstring instringB)
    {
        jstring str = (*env)->NewStringUTF(env, "HelloWorld from JNI !");
        return str;       
    }
    /*
    * Class:     com_ndk_test_JniClient
    * Method:    AddInt
    * Signature: (II)I
    */
    JNIEXPORT jint JNICALL Java_com_ndk_test_JniClient_AddInt
      (JNIEnv *env, jclass arg, jint a, jint b)
    {
        return a + b;
    }
    #ifdef __cplusplus   
    }   
    #endif
    



  • 相关阅读:
    Visualvm 远程测试 问题
    jsp中文件下载的实现
    MYOB 的一些开发资料
    连接MYOB ODBC,在MyEclipse 下Commit成功,在Tomcat下单独运行,Commit显示Connection 已经关闭
    也说说学习
    objectivec static变量的使用总结
    objective里面的单例模式
    对函数式编程简单理解
    个人技术生涯的感悟(2)
    苹果键盘快捷键图标
  • 原文地址:https://www.cnblogs.com/brucemengbm/p/7095734.html
Copyright © 2011-2022 走看看