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: main
java.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.)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值