Android Studio Installation and Setup
Prerequisites
- A supported environment. See Installation Prerequisites 
- Android Studio 2.3.3 or Studio 3.0 https://developer.android.com/studio/index.html 
Setup
- unzip the Android Studio Bundle 
- launch Android Studio. This may take quite some time as additional downloads and setup steps are completed. These steps are necessary for Studio to run properly. 
- after the previous step is complete, it is necessary install the SDK and build tools. SDK Manager is located in: Tools --> Android --> SDK Manager. It is also possible to access the SDK Manager without opening a project by selecting it from the dialog box Android Studio presents at startup:  - The SDK Manager window looks like this:  - Make sure to install the platforms and tools that your project requires.   
Compiling cpp-tests
cpp-tests is a project you can run to get familiar with how to code using Cocos2d-x. To run this project with Android Studio:
- import the - cpp-testsproject from cocos2d-x root/tests/cpp-tests/proj.android in Android Studio. Android Studio will do everything required. You can run- cpp-testsby clicking on the Play button. - note: Android Studio is going to download many components. It may even throw errors that you just click to fix. These errors may include: gradle version updates, installing missing build tools, agreeing to license agreements, etc.  
Starting a new project
Starting a new project requires a few steps:
- first, use cocos new ...to create your project. See the Cocos Command-line tool for additional help.
- next, launch Android Studio.
- next, you must specify what version of the Android SDK you are using. You can do this by modifying gradle.properties  
Debugging c++
Starting with cocos2d-x v3.15, you can use Android Studio 2.3+ to debug c++ code by setting breakpoints where you wish.
  
Build for release mode
There are a few required steps to build in release mode:
- change Build Variant to release
- set signing information in gradle.properties
- for lua projects, if you want to encrypt lua codes, you should set encrypt information in gradle.properties too   
Installing new SDK versions and build tools
- use the built in SDK Manager to install the SDK versions and build tools that you are targetting.    - Note: It is important to note that Android Studio uses a location to install SDK versions and build tools that is not the same as if you were doing command-line development. Double check that you have everything you need installed from inside Android Studio. 
Troubleshooting
Please see this F.A.Q for troubleshooting help.
