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

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

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)

{

JniHelper::setJavaVM(vm);

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();

CCApplication::sharedApplication()->run();

}

else

{

ccGLInvalidateStateCache();

CCShaderCache::sharedShaderCache()->reloadDefaultShaders();

ccDrawInit();

CCTextureCache::reloadAllTextures();

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

CCDirector::sharedDirector()->setGLDefaultValues();

}

}

}

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.

i have apply this code but get some error like
arm64-v8a are not available for platform
using cocos2d-x-3.16

I used this and it built just fine, even ran on my Samsung device. However, when I tried to submit it to the Google Play store it said it now supports 0 devices. In my APK “libs” folder I have .so files in both the “arm64-v8a” and “armeabi-v7a” folders. So it appears to have build both versions. Any idea why Google Play says I have 0 devices supported. BTW, I am building with NDK r10E, in case that makes a difference.

1 Like

Hi,
I used cocos2d-x 2.2.6 and javascript.


When I tried this git , I got error in javascript/bindings:

‘JSBool’ does not name a type.

How can I do?
Since it is for 3.x version?