cocos2d-x 4.x Android Studio setup

Install Android Studio and setup SDKs using SDKManager.

  1. In SDK Platforms tab, install latest Android SDK
  2. In SDK Tools tab, install following tools:
    • Android SDK Build-Tools
    • NDK (Side by side)
    • CMake
    • Android Emulator
    • Android SDK Platform-Tools
    • Android SDK Tools

Import proj.android from new project created with cocos.

In the “Project Structure” dialog, set the value of Project > Gradle Version to 5.6.4 as following:

And set the value of SDK Location > Android NDK Location to the previously installed value available in the drop-down as following:

You can also set the Gradle Version manually in “gradle-wrapper.properties” as following:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Update plugin using link in popup dialogs

Chang PROP_APP_ABI in “gradle.properties” to include all ABIs.

PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86

Run the application

Reference: