【发布时间】:2014-10-26 22:39:18
【问题描述】:
我在eclipse中使用NDK。
这是我在 java 中的 NativeLib:
public class NativeLib {
public native String enCode(String src);
static {
System.loadLibrary("HelloWorld");
}
public native String deCode(String src);
}
这是 C 源代码:
#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);
}
我的项目在 android 4.2 中运行正常,但在 android 4.3(Tablet ASUS K012) 中出现如下错误
java.lang.UnsatisfiedLinkError: 无法从加载器 dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.helloworld-2.apk"],nativeLibraryDirectories=[/data 加载 HelloWorld /app-lib/com.example.helloworld-2, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary 返回 null
谁能帮帮我?
【问题讨论】:
-
这款平板电脑的处理器是什么?你为这个处理器提供了本地库吗?
-
@Selvin 我不明白。我忘记了我将我的图书馆与 vitamio 一起使用。如果我不使用 vitamio 它运行正常。
-
你是如何解决这个问题的?
标签: java android android-ndk