Reputation: 111
I use NDK in eclipse.
This is my NativeLib in java:
public class NativeLib {
public native String enCode(String src);
static {
System.loadLibrary("HelloWorld");
}
public native String deCode(String src);
}
This is C source:
#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);
}
My project run normally in android 4.2 but in android 4.3(Tablet ASUS K012) It get error like below
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
Can anyone help me?
Upvotes: 2
Views: 3937
Reputation: 1031
It could be because you are not compiling your native code for all platforms. ASUS K012 is running Intel processor and that might be the reason. Add a file called application.mk within your JNI folder and the following parameter APP_ABI := all
This compiles the native portion for all platforms.
Upvotes: 4