Just in-case you didn’t read this blog post. The Android NDK Team is now recommending people to switch to libc++ Which means soon enough, The default for cocos should be c++_shared orc++_static
Apperently by r17, libc++ will be the default
libc++ is out of beta and is now the preferred STL in the NDK. Starting in r17, libc++ is the default STL for CMake and standalone toolchains. If you manually selected a different STL, we strongly encourage you to move to libc++
I think cocos should switch over to libc++ whe r16 comes out fully. I tested a fresh clone from github and it works with r16beta-1. There is just on thing you have to change in the ndk which they already patched for r16beta-2
Is libc++ stable now? We changed to use libc++ in some version, but meet some strange issues, and in that time, libc++ release note says it is not stable.
If you make a new, you usually runs fine. My game which I’ve been working on for a while now works on libc++. Only thing is to make sure external sdks like SDKBOX update their libs
I’m not saying to update it now, but the NDK team is saying when they release r16, libc++ will be the preferred and by r17, it will be default
I think cocos2d-x should look into making libc++ the default when r16 releases.
Yea iOS has always used clang and libc++. I don’t understand why it took so long for Android NDK to get off gnustl. It is missing may of the stl functions that people would usually use
I had to implement my own to_string while using gnustl because it didn’t have it
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled zprojects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
PROP_COMPILE_SDK_VERSION=19
PROP_APP_PLATFORM=19
PROP_MIN_SDK_VERSION=19
PROP_TARGET_SDK_VERSION=27
PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86
android.library.reference.1=../cocos2d/cocos/platform/android/java/libs/gps/
I don’t know, if it’s possible even to build libs via android studio?
I just copied that config from some old topic and some guys helped me with that. Too bad, that there is nobody making proper tutorial about that and documentation is abandoned and old for prebuilt libs and other…
Hmmm I see. I definitely understand the benefits of using prebuilt libs. I guess it’s just that no one has tried to standardize and modernize it for cocos2d-x.
Maybe we should work together to do that. I am currently an Android developer so I know my way around the ecosystem pretty well.
We should migrate from Ant to Gradle first and get pre-built libraries working with Android Studio
@slackmoehrle is that something we can do since it is kind of a big part of the dev process for android or is that something that we should leave up to the cocos developers?
Thats good for you but me, as iOS only dev is nothing understandable… I just know that some current work in some way for my game and I can run it on android. But if it best, or stable I don’t know…
Also, c++_static should be used because gnustl_static will be abandoned soon. However, it’s nobody starting to use and test it for now…
I think we are going to recommend not using the pre-built libraries on Android because there are so many factors that play into how they are compiled and and what SDK version, etc. on IOS and Windows pre-builts are great. very simple, no frustration. Android not so much. Let me talk to the team and get their thoughts.
Actually I’m using it without problems, for last 3-4 month. Main problems arrive when I’m trying to use latest NDK and static and documentation abandoned, without examples.
Prebuilt libs sholud be n1 method of using cocos2d-x. It will save time and space, also update of cocos game project is amazingly simple.(you don’t need to change anything in project, just recompile libs once and it will work for all games you develop, because cocos is shared between).