未找到在NDK本地实现 [英] No Implementation found for native in ndk

查看:151
本文介绍了未找到在NDK本地实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打一个错误,使用JNI ......我在android的活动类,一个简单的本地方法,创造了头并实施了该C文件...找不到错误请帮助

下面是我的文件

活动

 静态{
        的System.loadLibrary(fluidsynth);
    }    私人本地字符串textOverjni();

头文件

  / * DO NOT EDIT这个文件 - 它是生成的机器* /
#包括LT&;&jni.h GT;
/ *头类com_example_fluidsynthtest_MyFluidSynthO * /的#ifndef _Included_com_example_fluidsynthtest_MyFluidSynthO
#定义_Included_com_example_fluidsynthtest_MyFluidSynthO
#IFDEF __cplusplus
为externC{
#万一
和#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_PRIVATE
#定义com_example_fluidsynthtest_MyFluidSynthO_MODE_PRIVATE 0L
和#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_READABLE
#定义com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_READABLE 1L
和#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_WRITEABLE
#定义com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_WRITEABLE 2L
和#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_APPEND
#定义com_example_fluidsynthtest_MyFluidSynthO_MODE_APPEND 32768L
和#undef com_example_fluidsynthtest_MyFluidSynthO_BIND_AUTO_CREATE
#定义com_example_fluidsynthtest_MyFluidSynthO_BIND_AUTO_CREATE 1L
和#undef com_example_fluidsynthtest_MyFluidSynthO_BIND_DEBUG_UNBIND
#定义com_example_fluidsynthtest_MyFluidSynthO_BIND_DEBUG_UNBIND 2L
和#undef com_example_fluidsynthtest_MyFluidSynthO_BIND_NOT_FOREGROUND
#定义com_example_fluidsynthtest_MyFluidSynthO_BIND_NOT_FOREGROUND 4L
和#undef com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_INCLUDE_ code
#定义com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_INCLUDE_ code 1L
和#undef com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_IGNORE_SECURITY
#定义com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_IGNORE_SECURITY 2L
和#undef com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_RESTRICTED
#定义com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_RESTRICTED 4L
和#undef com_example_fluidsynthtest_MyFluidSynthO_RESULT_CANCELED
#定义com_example_fluidsynthtest_MyFluidSynthO_RESULT_CANCELED 0L
和#undef com_example_fluidsynthtest_MyFluidSynthO_RESULT_OK
#定义com_example_fluidsynthtest_MyFluidSynthO_RESULT_OK -1L
和#undef com_example_fluidsynthtest_MyFluidSynthO_RESULT_FIRST_USER
#定义com_example_fluidsynthtest_MyFluidSynthO_RESULT_FIRST_USER 1L
和#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DISABLE
#定义com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DISABLE 0L
和#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DIALER
#定义com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DIALER 1L
和#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SHORTCUT
#定义com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SHORTCUT 2L
和#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_LOCAL
#定义com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_LOCAL 3L
和#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_GLOBAL
#定义com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_GLOBAL 4L
/ *
 *类别:com_example_fluidsynthtest_MyFluidSynthO
 *方法:textOverjni
 *签名:()Ljava /朗/字符串;
 * /
JNIEXPORT的jstring JNICALL Java_com_example_fluidsynthtest_MyFluidSynthO_textOverjni
  (JNIEnv的*,jobject);#IFDEF __cplusplus
}
#万一
#万一

C文件

 的#include< jni.h>
#包括LT&;&string.h中GT;
#包括LT&;&MyFluidSynthO.h GT;
JNIEXPORT的jstring Java_com_example_fluidsynthtest_MyFluidSynthO_textOverjni
  (JNIEnv的* ENV,jobject OBJ){
    返回(* ENV) - GT; NewStringUTF(ENV,您好!Worlddd从MyFluidSynth1);
}

Android.mk

  LOCAL_PATH:= $(叫我-DIR)包括$(CLEAR_VARS)LOCAL_MODULE:= fluidsynth
#LOCAL_C_INCLUDES +:= $(LOCAL_PATH)/包括\\
$(LOCAL_PATH)/有/ fluidsynthLOCAL_SRC_FILES +:= \\
    MyFluidSynthO.c
#LOCAL_LDLIBS:= -llog
包括$(BUILD_SHARED_LIBRARY)的#include $(CLEAR_VARS)的#include $(BUILD_SHARED_LIBRARY)


解决方案

有关没有找到执行的问题,同时建立的Andr​​oid NDK,你可以看看下面这解释了这些问题的原因和解决办法的链接。

<一个href=\"http://stackoverflow.com/questions/2197889/android-ndk-c-jni-no-implementation-found-for-native?rq=1\">Android NDK C ++ JNI(不执行发现原生...)

<一个href=\"http://stackoverflow.com/questions/10814143/android-ndk-jni-no-implementation-found-error?rq=1\">android NDK JNI没有实现找到错误

<一个href=\"http://stackoverflow.com/questions/11505927/no-implementation-found-for-native-error-when-calling-c-function-android-ndk?rq=1\">"No执行发现原生&QUOT;错误,当调用C函数 - 的Andr​​oid NDK - Eclipse的

I am struck with an error, using the jni ... I have a simple native method in android activity class and created header for that and implemented the c file for that...unable to find the mistake pls help

Here are the files that I have

Activity

static{
        System.loadLibrary("fluidsynth");
    }



    private  native String textOverjni();

Header file

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_example_fluidsynthtest_MyFluidSynthO */

#ifndef _Included_com_example_fluidsynthtest_MyFluidSynthO
#define _Included_com_example_fluidsynthtest_MyFluidSynthO
#ifdef __cplusplus
extern "C" {
#endif
#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_PRIVATE
#define com_example_fluidsynthtest_MyFluidSynthO_MODE_PRIVATE 0L
#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_READABLE
#define com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_READABLE 1L
#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_WRITEABLE
#define com_example_fluidsynthtest_MyFluidSynthO_MODE_WORLD_WRITEABLE 2L
#undef com_example_fluidsynthtest_MyFluidSynthO_MODE_APPEND
#define com_example_fluidsynthtest_MyFluidSynthO_MODE_APPEND 32768L
#undef com_example_fluidsynthtest_MyFluidSynthO_BIND_AUTO_CREATE
#define com_example_fluidsynthtest_MyFluidSynthO_BIND_AUTO_CREATE 1L
#undef com_example_fluidsynthtest_MyFluidSynthO_BIND_DEBUG_UNBIND
#define com_example_fluidsynthtest_MyFluidSynthO_BIND_DEBUG_UNBIND 2L
#undef com_example_fluidsynthtest_MyFluidSynthO_BIND_NOT_FOREGROUND
#define com_example_fluidsynthtest_MyFluidSynthO_BIND_NOT_FOREGROUND 4L
#undef com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_INCLUDE_CODE
#define com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_INCLUDE_CODE 1L
#undef com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_IGNORE_SECURITY
#define com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_IGNORE_SECURITY 2L
#undef com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_RESTRICTED
#define com_example_fluidsynthtest_MyFluidSynthO_CONTEXT_RESTRICTED 4L
#undef com_example_fluidsynthtest_MyFluidSynthO_RESULT_CANCELED
#define com_example_fluidsynthtest_MyFluidSynthO_RESULT_CANCELED 0L
#undef com_example_fluidsynthtest_MyFluidSynthO_RESULT_OK
#define com_example_fluidsynthtest_MyFluidSynthO_RESULT_OK -1L
#undef com_example_fluidsynthtest_MyFluidSynthO_RESULT_FIRST_USER
#define com_example_fluidsynthtest_MyFluidSynthO_RESULT_FIRST_USER 1L
#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DISABLE
#define com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DISABLE 0L
#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DIALER
#define com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_DIALER 1L
#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SHORTCUT
#define com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SHORTCUT 2L
#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_LOCAL
#define com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_LOCAL 3L
#undef com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_GLOBAL
#define com_example_fluidsynthtest_MyFluidSynthO_DEFAULT_KEYS_SEARCH_GLOBAL 4L
/*
 * Class:     com_example_fluidsynthtest_MyFluidSynthO
 * Method:    textOverjni
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_com_example_fluidsynthtest_MyFluidSynthO_textOverjni
  (JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif

C file

#include <jni.h>
#include <string.h>
#include <MyFluidSynthO.h>


JNIEXPORT jstring  Java_com_example_fluidsynthtest_MyFluidSynthO_textOverjni
  (JNIEnv* env, jobject obj){
    return (*env)->NewStringUTF(env, "Hello Worlddd from MyFluidSynth1 !");
}

Android.mk

LOCAL_PATH := $(call my-dir)

include  $(CLEAR_VARS)

LOCAL_MODULE   := fluidsynth
#LOCAL_C_INCLUDES +:= $(LOCAL_PATH)/include\
$(LOCAL_PATH)/include/fluidsynth

LOCAL_SRC_FILES +:= \
    MyFluidSynthO.c
#LOCAL_LDLIBS := -llog
include  $(BUILD_SHARED_LIBRARY)

#include $(CLEAR_VARS)

#include $(BUILD_SHARED_LIBRARY)

解决方案

For "No implementation found" issues while building Android NDK, you can look into following links which explain the reasons and solutions for these problems.

Android NDK C++ JNI (no implementation found for native...)

android ndk jni No implementation found error

"No implementation found for native" error when calling C function - Android NDK - Eclipse

这篇关于未找到在NDK本地实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆