[Critical] Support for 64bit on cocos2d-x on Android!

[Critical] Support for 64bit on cocos2d-x on Android!

if you donot libwebsocket, just remove it.

I just search and found the following link has those libraries for arm64-v8a. Do you think we can use it?

Thanks, I removed it(I use HttpClient…etc…). Build Done!!

But crash… :frowning:

2019-02-04 22:52:28.720 15369-15528/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7c0000063c in tid 15528 (GLThread 2308), pid 15369 (stfantasy1super)
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: Build fingerprint: ‘google/bullhead/bullhead:8.1.0/OPM2.171019.029/4657601:user/release-keys’
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: Revision: ‘rev_1.0’
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: ABI: ‘arm64’
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: pid: 15369, tid: 15528, name: GLThread 2308 >>> com.sosc.firstfantasy1super <<<
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7c0000063c
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x0 0000007c00000000 x1 0000000000200002 x2 0000007c8dbff484 x3 0000000000000002
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x4 0000007c8dbff280 x5 0000007c901d8e38 x6 0000007d3232f000 x7 0000000000000000
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x8 00000000000000c8 x9 0000007c9705b9d4 x10 0000007c8dbff2d0 x11 0000000000000008
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x12 0000007c90173e60 x13 ffffffffa3a96d36 x14 0006d8f718000000 x15 003b9aca00000000
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x16 0000007c97219428 x17 0000007d2f9012f0 x18 0000000000008c38 x19 0000007c00000000
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x20 0000007c97233650 x21 0000000000000000 x22 0000007c900f0380 x23 0000007c956dde30
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x24 0000007c8dbff488 x25 0000007c956dde50 x26 0000007c972337d0 x27 0000007c96c3018c
2019-02-04 22:52:28.825 15578-15578/? A/DEBUG: x28 0000007c970457a0 x29 0000007c8dbff400 x30 0000007c96c2fa1c
2019-02-04 22:52:28.826 15578-15578/? A/DEBUG: sp 0000007c8dbff3a0 pc 0000007c96d6ad9c pstate 0000000060000000
2019-02-04 22:52:28.829 15578-15578/? A/DEBUG: backtrace:
2019-02-04 22:52:28.829 15578-15578/? A/DEBUG: #00 pc 0000000000526d9c /data/app/com.sosc.firstfantasy1super-o6ol-Iz5LAVgX16ZCUIqaA==/lib/arm64/libcocos2dcpp.so
2019-02-04 22:52:28.829 15578-15578/? A/DEBUG: #01 pc 00000000003eba18 /data/app/com.sosc.firstfantasy1super-o6ol-Iz5LAVgX16ZCUIqaA==/lib/arm64/libcocos2dcpp.so
2019-02-04 22:52:28.829 15578-15578/? A/DEBUG: #02 pc 0000000000067d0c /system/lib64/libc.so (__pthread_start(void*)+36)
2019-02-04 22:52:28.830 15578-15578/? A/DEBUG: #03 pc 000000000001eba4 /system/lib64/libc.so (__start_thread+68)
2019-02-04 22:52:31.993 590-590/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_09
2019-02-04 22:52:32.099 427-427/? E/lowmemorykiller: Error writing /proc/15369/oom_score_adj; errno=22
2019-02-04 22:52:32.157 766-9813/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 68)
2019-02-04 22:52:32.165 766-1248/? E/InputDispatcher: channel ‘a985cf com.sosc.firstfantasy1super/com.sosc.firstfantasy1super.FirstFantasy (server)’ ~ Channel is unrecoverably broken and will be disposed!
2019-02-04 22:52:32.166 428-460/? E/SurfaceFlinger: Failed to find layer (SurfaceView - com.sosc.firstfantasy1super/com.sosc.firstfantasy1super.FirstFantasy#0) in layer parent (no-parent).

Does it crash at start?

Please check this line https://github.com/cocos2d/cocos2d-x/blob/8fc3b7b4064b107d85c15a4895d08e9ad335b5a8/templates/cpp-template-default/proj.android/app/jni/hellocpp/main.cpp#L39

is x86 & x86_64 for android phones or chrome books or both ?

Can you share what you have done? So, I will try to compile and test it in v2.2.6 sample project and share the result later. Thanks.

My main.cpp is …

#include “AppDelegate.h”

#include “cocos2d.h”

#include “CCEventType.h”

#include “platform/android/jni/JniHelper.h”

#include <jni.h>

#include <android/log.h>

#define LOG_TAG “main”

#define LOGD(…) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,VA_ARGS)

using namespace cocos2d;

extern “C”


jint JNI_OnLoad (JavaVM *vm, void *reserved)



return JNI_VERSION_1_4;


void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit (JNIEnv* env, jobject thiz, jint w, jint h)


if (!CCDirector::sharedDirector()->getOpenGLView())


CCEGLView *view = CCEGLView::sharedOpenGLView();

view->setFrameSize(w, h);

AppDelegate *pAppDelegate = new AppDelegate();









CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND, NULL);





I have to change it??

Yes, please merge or just replace from latest cocos2d

It’s not working.
Auctually, Build is successed, I can see first scene…
But few second later. Game is crash…Same log… :frowning:

I don’t know why… :frowning:

Hi all.

i used cocos2djs 3.16 for my game
i edited in my app
In Application.mk: APP_ABI := armeabi-v7a arm64-v8a
And in gradle properties: PROP_APP_ABI=armeabi-v7a:arm64-v8a

but build fail with error
[arm64-v8a] Compile++ : audioengine_static <= mp3reader.cpp
/frameworks/cocos2d-x/cocos/audio/android/mp3reader.cpp: In function ‘bool resync(mp3_callbacks*, void*, uint32_t, off64_t*, uint32_t*)’:
/frameworks/cocos2d-x/cocos/audio/android/mp3reader.cpp:229:43: error: ‘memcmp’ was not declared in this scope
if (memcmp(“ID3”, id3header, 3)) {
/frameworks/cocos2d-x/cocos/audio/android/mp3reader.cpp:274:48: error: ‘memcpy’ was not declared in this scope
memcpy(buf, tmp, remainingBytes);
make: *** [/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/objs/audioengine_static/mp3reader.o] Error 1
make: *** Waiting for unfinished jobs…

before i build successful with config
In Application.mk: APP_ABI := armeabi
And in gradle properties: PROP_APP_ABI=armeabi

what can i do?
Thanks you so much.

I try to support 64bit. (arm64-v8a)

I use cocos2dx v3.1 with ndk ndk10e . i am using eclipse.

Can anyone guide me, how to upgrade to arm64-v8a.

Try this engine!

Build success!

still crash ??

No, It is good.

I modified my text.

Thanks :slight_smile:

it’s better to switch to Android Studio.

Thank you. i will try Android Studio. Hope i can produce 64 Bit ApK.

God! my project is cocos3.8 -lua 。I see the changelog V3.11.1 support android 64,then i upgrade to 3.13.1.but run android 64 device is black screen. and no some error log

without an error log or more information, I am not sure how to answer this.

I find some different,I build armabi and arm64-v8a. armabi is fine.but v8a is some error. game is get resource from a zip。
at unzip.cpp in unzReadCurrentFile always return Z_DATA_ERROR。

@tell_me_why I am not sure why this would be happening. I guess you should create a new topic about this so we can tag in some other users that might be able to help.