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

2019-01-27 03:30发布

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条回答
手持菜刀,她持情操
2楼-- · 2019-01-27 04:22

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.

查看更多
登录 后发表回答