首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

应用ndk 运行的时候library not found

2013-01-11 
使用ndk 运行的时候library not found本帖最后由 jxcyly1985 于 2011-04-13 13:58:55 编辑我根据网上的方

使用ndk 运行的时候library not found
本帖最后由 jxcyly1985 于 2011-04-13 13:58:55 编辑 我根据网上的方法配制好了eclipse然后也生成了so文件
我运行的是NDK的hello-jni的例子
打包后打开那个apk 里面也有so文件 打包进去的是libhello-jni.so
代码我也进行了修改 改成了
static {
        System.loadLibrary("libhello-jni.so");
    }把"hello-jni.lib"加上了 "lib"

但是用模拟器运行的时候就崩溃了  那个例子使用的SDK是2.2的
有谁遇到过这个问题啊?帮帮忙 谢谢了
我是在windows7平台下开发。

错误日志
04-13 02:41:43.662: ERROR/Zygote(33): setreuid() failed. errno: 2
04-13 02:41:51.282: ERROR/Zygote(33): setreuid() failed. errno: 17
04-13 02:41:52.522: ERROR/BatteryService(59): usbOnlinePath not found
04-13 02:41:52.522: ERROR/BatteryService(59): batteryVoltagePath not found
04-13 02:41:52.522: ERROR/BatteryService(59): batteryTemperaturePath not found
04-13 02:41:52.542: ERROR/SurfaceFlinger(59): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-13 02:41:59.422: ERROR/EventHub(59): could not get driver version for /dev/input/mouse0, Not a typewriter
04-13 02:41:59.422: ERROR/EventHub(59): could not get driver version for /dev/input/mice, Not a typewriter
04-13 02:41:59.692: ERROR/System(59): Failure starting core service
04-13 02:41:59.692: ERROR/System(59): java.lang.SecurityException
04-13 02:41:59.692: ERROR/System(59):     at android.os.BinderProxy.transact(Native Method)
04-13 02:41:59.692: ERROR/System(59):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-13 02:41:59.692: ERROR/System(59):     at android.os.ServiceManager.addService(ServiceManager.java:72)
04-13 02:41:59.692: ERROR/System(59):     at com.android.server.ServerThread.run(SystemServer.java:184)
04-13 02:42:00.562: ERROR/SoundPool(59): error loading /system/media/audio/ui/Effect_Tick.ogg
04-13 02:42:00.572: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressStandard.ogg
04-13 02:42:00.572: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-13 02:42:00.572: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressDelete.ogg
04-13 02:42:00.572: ERROR/SoundPool(59): error loading /system/media/audio/ui/KeypressReturn.ogg
04-13 02:42:03.413: ERROR/ThrottleService(59): Could not open GPS configuration file /etc/gps.conf
04-13 02:42:04.922: ERROR/logwrapper(144): executing /system/bin/tc failed: No such file or directory
04-13 02:42:05.022: ERROR/logwrapper(145): executing /system/bin/tc failed: No such file or directory
04-13 02:42:05.042: ERROR/logwrapper(146): executing /system/bin/tc failed: No such file or directory
04-13 02:42:20.249: ERROR/HierarchicalStateMachine(59): TetherMaster - unhandledMessage: msg.what=3
04-13 03:23:34.869: ERROR/AndroidRuntime(276): FATAL EXCEPTION: main
04-13 03:23:34.869: ERROR/AndroidRuntime(276): java.lang.ExceptionInInitializerError
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at java.lang.Class.newInstanceImpl(Native Method)


04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at java.lang.Class.newInstance(Class.java:1429)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.os.Looper.loop(Looper.java:123)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invokeNative(Native Method)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invoke(Method.java:521)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at dalvik.system.NativeStart.main(Native Method)
04-13 03:23:34.869: ERROR/AndroidRuntime(276): Caused by: java.lang.UnsatisfiedLinkError: Library libhello-jni not found
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at java.lang.System.loadLibrary(System.java:557)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
04-13 03:23:34.869: ERROR/AndroidRuntime(276):     ... 15 more
04-13 04:55:16.259: ERROR/AndroidRuntime(306): FATAL EXCEPTION: main
04-13 04:55:16.259: ERROR/AndroidRuntime(306): java.lang.ExceptionInInitializerError
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at java.lang.Class.newInstanceImpl(Native Method)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at java.lang.Class.newInstance(Class.java:1429)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)


04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.os.Looper.loop(Looper.java:123)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at java.lang.reflect.Method.invokeNative(Native Method)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at java.lang.reflect.Method.invoke(Method.java:521)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at dalvik.system.NativeStart.main(Native Method)
04-13 04:55:16.259: ERROR/AndroidRuntime(306): Caused by: java.lang.UnsatisfiedLinkError: Library ./lib/armeabi/libhello-jni not found
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at java.lang.System.loadLibrary(System.java:557)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
04-13 04:55:16.259: ERROR/AndroidRuntime(306):     ... 15 more
04-13 04:57:39.959: ERROR/AndroidRuntime(338): FATAL EXCEPTION: main
04-13 04:57:39.959: ERROR/AndroidRuntime(338): java.lang.ExceptionInInitializerError
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at java.lang.Class.newInstanceImpl(Native Method)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at java.lang.Class.newInstance(Class.java:1429)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.os.Looper.loop(Looper.java:123)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at java.lang.reflect.Method.invokeNative(Native Method)


04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at java.lang.reflect.Method.invoke(Method.java:521)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at dalvik.system.NativeStart.main(Native Method)
04-13 04:57:39.959: ERROR/AndroidRuntime(338): Caused by: java.lang.UnsatisfiedLinkError: Library ./lib/armeabi/libhello-jni.so not found
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at java.lang.System.loadLibrary(System.java:557)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
04-13 04:57:39.959: ERROR/AndroidRuntime(338):     ... 15 more

[解决办法]
System.loadLibrary("libhello-jni.so"); 
参数不对
[解决办法]
配置文件正确吗?

[解决办法]
我有怀疑so的名字和你SYSTEM.loadlib不对应
[解决办法]
我今天也遇到此类问题,基本确定你的.so有问题,我是修改了.mk文件后编译才正确的。楼主请检查你的mk文件吧
[解决办法]
去了解一下LIB的几种加载/附带方式吧
[解决办法]
System.loadLibrary("libhello-jni.so"); 

应该修改成

System.loadLibrary("hello-jni"); 

热点排行