How can I use Android Studio together with cocos2d-x? Any hints?

Do I have to run the compile command from the proj.android directory? I usually run the compile command from the root of all proj.x (x being the platform) folder. You seem to have run it from the proj.android directory.

I compile the android project with the following command:

$ cocos compile -p android --android-studio

is this different from the one that you have written?

$ cocos compile -pandroid --android-studio

Does Android Studio recognize the cocos2dx classes and methods after creating symbolic links? I am new to cocos2dx. Without code suggestion I am totally blind and much more prone to making errors :frowning:

You should be able to do everything inside Android Studio if you wish. I’ll review this thread as I started writing an Android Studio install doc. http://slackmoehrle.github.io/installation/Android-Studio/

But does android studio allow users to edit the .cpp files with code-completion support?

Yes! Android Studio is built on top of, among other things, CLion, a C/C++ IDE from Jet Brains, which includes C/C++ syntax highlighting. The main problem that people are facing (including me) here is to configure it properly…

After a few months of fighting with Android Studio, C++ and NDK support I said “whatever” and just use command lines to build and deploy everything.

I edit all of my Android C++ in Visual Studio, and use a VS “External Tool” to call the Android Studio scripts. I am doing almost all Cocos2d-x development, so most of the work is in C++ with only occasional Java. I find having a C++ project for iOS, Android, Linux and Mac OS X to be the easiest way to organize the code and build files.

2 Likes

I gave up after a few hours :wink: