cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.24k stars 7.06k forks source link

Default NDK no longer supported for Google Play Store uploads. #20754

Open Josh1603 opened 2 years ago

Josh1603 commented 2 years ago

It would seem that as it is, this engine can no longer be used to build games which can be published on the Google Play Store.

As of November 2022 Google Play Store uploads require Android 12 ( API level 31 ) as a minimum target API level.

Android 12's minimum required NDK version is now NDK r23 (NDK 23.0.7599858)

Steps I took to fix:

1) Download a compatible NDK ( I used NDK 23.0.7599858 ) 1) Remove ndk.dir= from local.properties file 2) Add ndkVersion = "23.2.8568313" to project level build.gradle file 3) Add implementation 'androidx.work:work-runtime-ktx:2.7.0' to project level build.gradle dependencies

rh101 commented 2 years ago

There is an existing fork of Cocos2d-x v4 that works with the latest NDK, so perhaps you can back-port the changes if you don't want to use the fork. You can find it here.

kadko commented 2 years ago

I am using NDK 22 almost latest, with this cocos2dx v4, I just changed NDK path resided in local.properties file and it works

Josh1603 commented 1 year ago

Thanks rh101, I'll have a crack with that.

I noticed all the NDK r22 releases led to runtime crashes when I tested this out with a Cocos2d-x project on a Pixel 6. Besides, even though NDK r22 is a relatively new release (March, 2021), NDK r22 is still too low to meet the current app store requirement. Android 12 was released in October, 2021 and requires NDK r23.

Josh1603 commented 1 year ago

With the fixes mentioned in the answer, I'm no longer having any runtime crashes.

xixuangezu commented 1 year ago

There is an existing fork of Cocos2d-x v4 that works with the latest NDK, so perhaps you can back-port the changes if you don't want to use the fork. You can find it here.

When I use the Ndk r23, the following errors will be reported when compiling, but the Ndk r21 can be used normally. What should I do?:

ld: error: lib/libluacocos2d.a(CCLuaEngine.cpp.o): unable to find library from dependent library specifier: lua51.lib