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

1

2

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
Humane answered 25/11, 2012 at 20:51 Comment(4)
I think Cocos2d-x is not tested in Android > 4. But compiling with target 3.0 must work.Heyday
@Piperoman I've tested on my 4.1 device and it worked perfectly. I believe my target was 2.1 or 2.2, would a lower target be the issue?Humane
Probably not. Try asking in official forum: cocos2d-x.org/projects/cocos2d-x/boards/6 because it could be a bug.Heyday
It's not a cocos problem, it's AndroidNDK 8 problem, but I haven't figured it out yet - many c++ libs built with r8 run into this issue in Android 4.2.Gaud
G
5

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.

Gaud answered 24/1, 2013 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.