Eclipse ndk sample hello-jni

Eclipse import hello-jni 工程,编译运行,出现如下错误:

sample 1 hello-jni Couldn't load hello-jni

错误日志:

 E/AndroidRuntime(2259): java.lang.UnsatisfiedLinkError: Couldn't load hello-jni from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.hellojni-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.hellojni-1, /vendor/lib, /system/lib]]]: findLibrary returned null

log所示加载库失败;

在hello-jni/jni目录下,打开命令行工具,运行:D:\ndk\android-ndk-r9d\ndk-build.cmd

Eclipse ndk sample hello-jni_第1张图片


Eclipse 编译运行,hello-jni sample正常运行;


sample2:hello-gl2 No such file or directory

错误截图:


原因:NDK默认的Android版本不支持GLES2

解决办法,/jni目录下增加application.mk文件,

增加APP_PLATFORM := android-9选项

重新编译,sample 2正常运行;




你可能感兴趣的:(Eclipse ndk sample hello-jni)