Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cocos2d-x-js crashes on android 4.4 when using NDK-r10d #1288

Closed
ddalcu opened this issue Jan 8, 2015 · 11 comments
Closed

Cocos2d-x-js crashes on android 4.4 when using NDK-r10d #1288

ddalcu opened this issue Jan 8, 2015 · 11 comments

Comments

@ddalcu
Copy link

ddalcu commented Jan 8, 2015

E/AndroidRuntime(29440): FATAL EXCEPTION: main
E/AndroidRuntime(29440): Process: com.symplestudios.penguinwars, PID: 29440
E/AndroidRuntime(29440): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libcocos2djs.so"...
E/AndroidRuntime(29440): at java.lang.Runtime.loadLibrary(Runtime.java:364)
E/AndroidRuntime(29440): at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime(29440): at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
E/AndroidRuntime(29440): at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
E/AndroidRuntime(29440): at android.app.Activity.performCreate(Activity.java:5600)
E/AndroidRuntime(29440): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
E/AndroidRuntime(29440): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2504)
E/AndroidRuntime(29440): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2599)
E/AndroidRuntime(29440): at android.app.ActivityThread.access$900(ActivityThread.java:174)
E/AndroidRuntime(29440): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
E/AndroidRuntime(29440): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(29440): at android.os.Looper.loop(Looper.java:146)
E/AndroidRuntime(29440): at android.app.ActivityThread.main(ActivityThread.java:5748)
E/AndroidRuntime(29440): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(29440): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(29440): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
E/AndroidRuntime(29440): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
E/AndroidRuntime(29440): at dalvik.system.NativeStart.main(Native Method)

compiles and runs fine with NDK-r9d, however the screen is blank.

Running on android 4.4... from what I googled.. it should work fine on 5.0, however anything older will crash.

@pandamicro
Copy link
Contributor

Can you try NDK r10c ? Our test is based on this version, it's also the official supported NDK version

@noosxe
Copy link

noosxe commented Apr 24, 2015

Any news on this ?

@mumreg
Copy link

mumreg commented Jun 22, 2015

Got the same crash on Android 4.4 with NDK r10c.

@perttuim
Copy link

perttuim commented Aug 9, 2015

I can also confirm the same error on Android 4.4.4 with NDK r10c.

@pandamicro
Copy link
Contributor

Guys, we have moved js to -x repo, which version are you using ? Which project are you compiling ? how are you compiling ?

@lafisrap
Copy link

Also with me: I get this bug on Android 4.4.4 with NDK r10e and either cocos2d-x-3.7.1 or cocos2d-x-3.6.1.

I found a conversation that seem to have solved it: http://discuss.cocos2d-x.org/t/need-help-android-app-crash-on-launch/18908

But I couldn't solve it with this description. I didn't find out how to define rand() in a way, that the runtime accepts it. The atof error disappeared.

I tried the test project from the 3.7.1 repo. And an own project, that runs fine on Android 5.

Compiling? I just use "cocos run -p android" in a fresh downloaded repo.

@mumreg
Copy link

mumreg commented Aug 28, 2015

I moved to 3.7.1 too. And everything seems to be fine.

@lafisrap
Copy link

I solved it! I think the problem was, that I used Android SDK API-22 and had as minimum API 10 defined in AndroidManifest. So now I use API-10 and it works on Android 4.4.4. My ndk is r10e.

I think there is no reason to use a new API with cocos2d-x. (objections welcome!)

@pandamicro
Copy link
Contributor

Thanks @lavisrap for your clarification ! I will close this issue, if someone met new problems, please open a new one in https://github.com/cocos2d/cocos2d-x/issues

@huangmr
Copy link

huangmr commented Mar 12, 2017

same issue here, I am using android sdk 22, ndk r10e, cocos2d-x 3.14.1, @lafisrap's suggestion doesn't work for me. I am using cocos creator and JS.

@huangmr
Copy link

huangmr commented Mar 13, 2017

according to cocos2d/cocos2d-x#15234, setting APP_PLATFORM := android-19 helped me in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants