Caused by: java.lang.UnsatisfiedLinkError: Cannot load library
when I tried to package an old cocos2dx NDK project, I encountered this problem, apk could be exported but crashed when start running it.
Here is the log I get from eclipse logcat:
FATAL EXCEPTION: mainjava.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1521]: 492 unknown reloc type 160 @ (60218)at java.lang.Runtime.loadLibrary(Runtime.java:434)at java.lang.System.loadLibrary(System.java:554)at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:246)at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:260)at org.cocos2dx.phonegame.PhoneGameActivity.onCreate(PhoneGameActivity.java:83)at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)at android.app.ActivityThread.access$1500(ActivityThread.java:117)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)at android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:130)at android.app.ActivityThread.main(ActivityThread.java:3683)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java:507)at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)at dalvik.system.NativeStart.main(Native Method)
First, I clean the project and rebuild it. but the problem is still there.
Then, I find another project and rewrite the Android.mk file under jni folder, but still not ok.
I don't think it's the problem with ndk version, because other project with the same ndk could run perfectly.
At last, I rewrite the Application.mk file under jni folder, this time the ndk compiler rebuild the libc++_static.a and everything is ok.
In a word, this problem in my case is caused by old wrong libc++static.a lib, and only clean the project and rebuild cannot update it.
Solution: Change the Application.mk and force the libc++static.a to be rebuild.
(ps:Maybe delete the obj folder could also make it.)
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer