Cocos2d-x v3.13 and sdk/ndk versions

v3.13 + android sdk 24 + ndk r11c (or r12b)

  • Crash on Galaxy Tab 3 (4.1.1) and Galaxy Note 4 (4.4.4).
  • Ok on Galaxy S7 (6.0.1) and Galaxy S6 (5.1.1).

I used

cocos new ndkvesion11 -p com.versions -l cpp -d D:\versions

then

cocos compile -s D:\versions\ndkversion11 -p android --ap android-24

Updated

Now I think --ap android-24 is the reason. If I use --ap android-16 then everything is fine.

I tested ndk r12b, r11c, and r10e.

Any advice will be highly appreciated.

Why u want to compile against latest android? What kind of error u have - I know that there was issue with cocos in previous build when app crashed on all 4.0.x devices - maybe it could be related.

Since Google recommends using the latest versions. I did not change the min sdk version, so I expected that it will be compatible with other devices.

I used remote test devices, and do not connect to it by adb. Apparently now I have to do it.

xmm, everyone trying to push latest features in their platform, but in reality better to stick with tested stuff. Like target sdk version 22, even #23 causing issue due permissions request. I really don’t see advantages of using latest - only more possible hidden issues.

1 Like

Thank you! I will try to 22.

There is a myth that this increases the position in the Store.

xexe:) I think we should check this by taking top apps and decompiling them:) to see what under hood.

Do I understand correctly that --ap affects the target sdk version? And it should have been fine… in theory.

something like that. I’m now using gradle(android-studio) and only setting it in gradle/manifest scripts, not passing as console parameter. You should add also in manifest if using eclipse target sdk version.

my advice start using android studio for android part.

I usually use the manifest, but this time decided to try the lazy option(–ap).
I think I need another laptop to use Android Studio. :smile:

android sdk 22 + ndk r12b

  • Still crash on Galaxy Tab 3 and Galaxy Note 4
  • Still Ok on Galaxy S7

This is the log for Note 4. I renamed the file to .h to upload.

ndk12b_sdk22.h (54.2 KB)

Hi guys, building with high level API can not make sure run on low API devices. And especially is that, Android NDK break compatibility since API 21.

In previous, cocos command will select an API level equal or higher than specified API level, and now(after v3.13), it changed the strategy, it will find the specific API level and will stop if not found.

Thanks for the reply!

In that case can we get recommendations which sdk/ndk versions should be used with each new version of the engine?

Or should we use sdk < 21 and new ndk and then everything will be fine?

SDK level is set by your self in command line. About NDK version, i think README has the information.

Yes, but now I do not know which version to use to be sure that there is no crash.

NDK r11+

I am not sure how to interpret it.
Is it all r11 versions (r11a, r11b, …) or all ndk versions from r11 and above (r12, r11)?

If anyone interested, it works fine on these devices when used v3.13 + sdk 19 + ndk r12b.

But I am still not sure if it works on all devices from 4.1.0 to 6.0.1.

Can someone else test it?

I will try later with same setup - but it really mess now - which NDK and Android SDK version to use for building project - would be good to have some kind table with cocos/NDK/Android SDK best version.

From my experience when Cocos2d-x stating that u should use NDK 11+ and then after using NDK 12 app starting randomly crash or not compiling it really confusing. In my understanding/expierence cocos engine newer works with latest NDK and Android SDK - so I’m confused which setup to choose…

Agree. For each cocos2dx version we should use fixed sdk/ndk version.
I think that it should be checked and forced in cocos console.
Right now everyone has different configuration and problems…

Regards
Chp

1 Like

It depends on which Android OS version do you want to run on. Android OS version and API level mapping can refer to this doc.

Default API level lies in APP_ROOT/proj.android/project.properties. But in pervious, cocos console will find the API level >= specified API level defined in project.properties. For example, the content of project.properties is

target=android-13

Cocos console will find 13 first, if not found then will found 14, and 15 until it found a API level that >= 13. We design like this is because developers may not have API 13, so it will be convenient to find a API that >= 13. And it works great until API 21, because API 21 break compatibility.

So changed the logic a few days ago in this patch, it will be included in v3.14. Cocos console will stop if it doesn’t find the specified API level.

I am not sure if i describe it clearly. And i am not sure if there is better way to fix it. Please let me know if you have any idea.

SDK 19 is Android 4.4, you can refer to this doc about API level and Android OS mapping. So it can not make sure that building with Android 4.4 dan run on Android 4.1.0. If you want to run on Android 4.1.0+, you should use API 16.

1 Like

Thank you! I am still a little confused, but I think that I will look deeper into the android documentation soon.