2014-09-02 120 views
1

我在日食中使用NDK。java.lang.UnsatisfiedLinkError:无法从加载器加载findLibrary返回null

这是我NativeLib在Java:

public class NativeLib { 

public native String enCode(String src); 

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

public native String deCode(String src); 
} 

这是C源:在Android 4.2,但采用Android 4.3(平板华硕K012)

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

jstring Java_com_example_helloworld_NativeLib_enCode(JNIEnv* env, 
    jobject thiz, jstring src) { 
... 
return (*env)->NewStringUTF(env, result); 
} 

jstring Java_com_example_helloworld_NativeLib_deCode(JNIEnv* env, jobject thiz, 
    jstring src) { 
... 
return (*env)->NewStringUTF(env, result); 
} 

我的项目的正常运行它得到错误,如低于

java.lang.UnsatisfiedLinkError: Couldn't load HelloWorld from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.helloworld-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.helloworld-2, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null

任何人都可以帮我吗?

+0

以及该平板电脑内的处理器是什么?你提供了这个处理器的本地库吗? – Selvin 2014-09-02 15:55:20

+0

@Selvin我不明白。我忘了我用我的图书馆与vitamio。如果我不使用vitamio它运行良好。 – Minato 2014-09-05 02:50:38

+0

你是如何解决这个问题的? – 2016-01-22 17:08:24

回答

3

这可能是因为您没有编译所有平台的本机代码。华硕K012运行Intel处理器,这可能是原因。在您的JNI文件夹中添加一个名为application.mk的文件,以及以下参数 APP_ABI:=全部

编译所有平台的本地部分。

相关问题