Android:No implementation found for native(转)

简介:

解决方法:

1.检查native c code的定义:

 

JNIEXPORT void Java_com_example_something_MyClass_getMyString(JNIEnv * env, jobject obj) {
其中:com_example_something为 package名的分解,MyClass为调用该.so的class

2.检查是否.so是否被加载到系统中:

 

adb shell ls -l /data/data/com.example.something/lib/

3. 假设lib为libtest.so

   复制该文件到libs目录下,代码中调用:

static
{
System.loadLibrary("test");//注意没有前缀 lib,对应为LOCAL_MODULE
}

附:典型的Android.mk

 

[html]  view plain copy
 
  1. LOCAL_PATH := $(call my-dir)  
  2.   
  3. include $(CLEAR_VARS)  
  4.   
  5. LOCAL_MODULE    := test  
  6. LOCAL_SRC_FILES := mytest.c  
  7.   
  8. include $(BUILD_SHARED_LIBRARY)  



 

 

JNIEXPORT void Java_com_example_something_MyClass_startServer(JNIEnv * env, jobject obj) {
其中:com_example_something为 package名的分解,MyClass为调用该.so的class


  ,如需转载请自行联系原作者	
相关文章
|
1月前
|
开发工具 Android开发 git
解决Android AAPT: error: resource android:attr/lStar not found. 问题
解决Android AAPT: error: resource android:attr/lStar not found. 问题
48 0
|
开发工具 Android开发
【错误记录】Android Studio 编译报错 ( SDK location not found )
【错误记录】Android Studio 编译报错 ( SDK location not found )
2227 0
【错误记录】Android Studio 编译报错 ( SDK location not found )
|
Java 开发工具 Android开发
【错误记录】Android Studio 编译报错 ( Invalid Gradle JDK configuration found )
【错误记录】Android Studio 编译报错 ( Invalid Gradle JDK configuration found )
642 0
【错误记录】Android Studio 编译报错 ( Invalid Gradle JDK configuration found )
|
9月前
|
Android开发
Android > Project with path ‘:audiovisualize‘ could not be found in project ‘:app‘. 异常解决方案
Android > Project with path ‘:audiovisualize‘ could not be found in project ‘:app‘. 异常解决方案
43 0
|
Android开发
AAPT: error: resource android:attr/dialogCornerRadius not found.
AAPT: error: resource android:attr/dialogCornerRadius not found.
161 0
|
Java
java.lang.UnsatisfiedLinkError: JNA support (com/sun/jna/android-arm/libjnidispatch.so) not found
java.lang.UnsatisfiedLinkError: JNA support (com/sun/jna/android-arm/libjnidispatch.so) not found
65 0
Plugin with id 'com.android.application' not found
Plugin with id 'com.android.application' not found
100 0
|
Android开发
AAPT: error: resource android:attr/lStar not found.
AAPT: error: resource android:attr/lStar not found.
1458 0
AAPT: error: resource android:attr/lStar not found.
|
API 开发工具 Android开发
【错误记录】Flutter / Android 报错 ( AAPT: error: attribute android:requestLegacyExternalStorage not found )
【错误记录】Flutter / Android 报错 ( AAPT: error: attribute android:requestLegacyExternalStorage not found )
604 0
【错误记录】Flutter / Android 报错 ( AAPT: error: attribute android:requestLegacyExternalStorage not found )
|
Android开发
解决 error: style attribute '@android:attr/windowEnterAnimation' not found.
解决 error: style attribute '@android:attr/windowEnterAnimation' not found.
145 0