Android development has come a long way since the days where you were sitting with a clunky / buggy / plain weird Eclipse interface, desperately tying to figure out what and how to download what you needed.
While Eclipse has evolved a lot, today we also have the option of using Android Studio.
Lucky for us, Android Studio 1.3 has just been released, including almost everything we need to go full Android. You can get it here
I installed everything default, so the rest of the tutorial will assume that.
When Android Studio has finished installing, you need to download Apache Ant also.
I downloaded the zip, and unpacked it into Library/Android. Notice, that in Library/Android, you will also have two folders named
Next step is to open terminal, and navigate to your cocos2d-x download folder. Here you execute ./setup.py
You will be asked for three paths. One for the NDK, one for the SDK, and one for ANT.
The NDK folder is the android-ndk- listed above.
The SDK folder is a sub-folder in the adt-bundle- folder, named sdk.
The ANT folder is a sub-folder in your unpacked ant download, named bin
Cocos2d-x will check if the folders are okay, otherwise it will give you an error. If you drag the folders into terminal, remember to delete the last space, before hitting enter.
When all three folders have been entered correctly, you should run the following command, to add the paths to the system
source /Users/<insert your username>/.profile
Now you are ready to build for Android. If you have created a project, open terminal and navigate to that folder. Not the proj.android folder, just the base folder.
After that, execute
cocos compile -p android
You project will now compile for Android. Final step is to connect an Android device to you Mac, and in the same folder as above, execute the command
cocos run -p android
This will launch the app on the device : )
The same thing can be achieved using other means of installing everything, but I found Android Studio easy to work with. You can of course also load your entire project into Android Studio, if there is anything Android specific you need to edit, but that is for another tutorial.