If everything works it is time to run setup.py to configure your Android development environment. This will set the necessary environment variables needed. If you haven’t configured this environment before, you will be prompted to enter paths for variables that are not found. You run setup.py from the directory Cocos2d-x is in.

Inside your Cocos2d-x directory run:

python setup.py

caution: You must not use the ~ sign. Use the full path to your home directory. Otherwise, the scripts will fail due to error path value.

Now it will ask for NDK_ROOT path. Here, enter the extracted NDK directory
path: