標籤:this not ati art content data and err instr
在利用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 __cplusplusextern "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
Android error--No implementation found for native Lcomd