After a long gap, today I downloaded cocos studio and cocos2d-x 3.10. During setup first I faced issue due to older version of NDK (I had r8c). Then based on documentation I downloaded updated version from given link which is r11c (64bit).
Started setup from scratch and this time I was able to pass FILE_MISSING error of previous NDK version. However cpp-test compilation failed with two errors
/Users/devilzk/Study/hello-cocos/frameworks/runtime-src/proj.android/../../cocos2d-x/external/spidermonkey/prebuilt/android/armeabi/libjs_static.a(ExecutableAllocatorPosix.o):function JSC::ExecutableAllocator::determinePageSize(): error: undefined reference to '__page_size'
– and –
/Users/devilzk/Study/hello-cocos/frameworks/runtime-src/proj.android/../../cocos2d-x/external/websockets/prebuilt/android/armeabi/libwebsockets.a(context.c.o):context.c:function libwebsocket_create_context: error: undefined reference to 'getdtablesize'
I tried changing version 4.8 to 4.9 in build_android.py, but that didn’t help. Same error appear when I try to compile any cocos project as well. I am really not getting any clue how to get past this error and get APK file.
Thanks in advance.
I always use r10-c, compiling issues of r11b is fixed a few days ago which is not included in 3.10.
Thanks for revert zhangxm, as per issue conversation on Github, I am already downloading r10c now and hopefully in next 3 hours (as soon as download get complete), I shall be able to confirm that it works fine with r10c.
Download for r10-c completed and I was able to successfully get APK compiled for default HelloWorld project! Thanks a lot zhangxm for all the help around this issue.
Now when I was able to get APK compiled, got another issue. Compiled in release mode and file size is more than 8 MB for JS project. Then I created a project with C++ and file size is 4.4 MB for that. My project require basic 2D game play, some position tweens and more importantly TCP socket communication (which I guess I have to implement using JSB binding for Android and call from JS) & web url json POST / GET.
So is there any way to disable unwanted part of framework or those are already disabled and yet getting this file size? I recall seeing game built using cocos2d-x under 5mb limits with graphics (not a good example but like this game is under 3.2mb https://play.google.com/store/apps/details?id=com.evrac.shoppingBusiness).
Thanks in advance
Found some references which talk about disabling non required modules in ccConfig.h / AppDelegate.cpp. I tried doing that (ccConfig.h set physics stuff as 0) and then attempt to compile and getting C++ errors. Reverted those and compile fines.
So perhaps I was disabling at wrong place?
@devilzk It is because JSB is not as good modularization as c++.
@pandamicro Is there any good way to cut down the package size?
@zhangxm Based on your suggestion (and also as a result of not finding much info about JSB optimization), I opted for C++. Also, as suggested on forums, instead of developing for Android first, doing for iOS so getting benefit of xcode for c++ debugging, which I couldn’t find easy with Android Studio.
So with C++, how I can disable unwanted modules if I am not using pre-compiled cocos2d-x libraries. Or during link process, it will automatically get stripped without any change from my side?
Yep, no used codes will be tripped. Because unit stripped by compiler is .o files, which mean all codes in a .cpp file will be included or not included by a whole.
Great! Thanks @zhangxm for clarifying that. So now only item left from my list is a C++ TCP socket client library, which can connect to my existing java based game server for multiplayer functionality. I got suggestions about
Asio for C++, but couldn’t locate any tutorial and still trying to figure how to integrate. I have a separate thread for that [SOLVED] TCP Socket Library. If you can help with that, it will be really helpful.
So marking this thread as resolved.