Cocos2D-x game fresh off the Play Store can't even open

不想你离开。 提交于 2019-11-28 05:34:56

问题


I just finished my first cocos2d-x game. I've tested it on my GNexus 4.1 and other lower devices, including tablets. However, when bought and downloaded to a Nexus 7, it won't even open. It's running 4.2, could that be the issue? Any help would be appreciated. crash report:

java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library:     soinfo_relocate(linker.cpp:975): cannot locate symbol "__exidx_end" referenced by               "libgame.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:535)
at com.penguinproductions.classiclightcycles.<clinit>(classiclightcycles.java:107)
... 15 more

回答1:


There are many application which suffer from this error. It occurs on Android 4.2 with project compiled using specific Android NDK - for me it was r8d, but you can find also people with other versions with that bug. Workaround I found is mentioned here. The solution is to add following lines of code in any of your .cpp files:

#ifdef __cplusplus
    extern "C" {
#endif

void __exidx_start() {}
void __exidx_end()   {}

#ifdef __cplusplus
    }
#endif

For me it worked.

But I think you must watch out, because in future version of NDK, when they finally fix this, these symbols might be defined twice, so this workaround will transform into a bug, actually.



来源:https://stackoverflow.com/questions/13555376/cocos2d-x-game-fresh-off-the-play-store-cant-even-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!