Android Studio: Build-Run AND Auto Complete?

Environment:

  1. Cocos2d-x v3.11.1 on mac
  2. NDK r10c
  3. Working on proj.android-studio

Question 1:
How to enable auto complete support for Android Studio?


For BUILD:
Cocos command from terminal
For RUN:

  1. adb install *debug.apk from termsinal
  2. Run button of android studio also works but it also builds something which I don’t know what which is an extra step after it is already built using terminal so I am avoiding itl!

Compiling from terminal is necessary here because Run button of android studio doesn’t compile it properly as it doesn’t detect changes done in Classes folder(I m using different Android studio window for making code changes as Classes folder isn’t accessible from proj.android-studio).
Question2:
How do you people COMPILE and run through android studio without involvement of terminal?


Questions3:
Also, do we really need to open 2 android studio windows to work on cocos2d-x project?
I mean one window window for proj.android-studio and other window for the entire project folder.
Because Classes folder is inaccessible when we open proj.android-studio

Thanks

@zhangxm Can you please help with this?

Also, people, since there is no support for cocos2d-x with android studio what are you using for ANDROID development on mac? Eclipse or Visual studio. If visual studio then can anyone give me pointers for setting up things for auto complete.

Right now I am using proj.android with Eclipse, may traditional way of working for auto complete.
But I won’t be able to utilize fast build system of Gradle and other features…

Thanks :smile:

I think you need android studio version 2.2 preview 1 + or newer I guess.
When you talk about the environment I think you need to download the Android NDK from the SDK manager So I guess it uses the NDK from the Android SDK manager.
You also need this patch to make it work

But I know the answer to the question 3 :smiley:
The new support of the android studio version 2.2 rev 1+ you only need just one window to work with android studio and even better you will have auto prediction and debug on the android platform. But from the official release version it will not work since the template project is not updated for that. download this patch

Aah! I see. Thank you.

Also, I read that thread. That support will supposedly be coming in the next cocos2d-x release where they might update the template folder.

I really love the Support for android studio is more easy to setup and test, Eclipse crash very frequently
In this post about remove ADT support Poll: Remove Android ADT support
I found instructions to use that patch also some updates for the ADT seems to work better I can say that the results are similar ok cocos2d-x itself is not a problem actually is better C/C++ code is great very fast. The real problem are the old libraries that doesn’t work in Android Studio not a lot but problably that’s a problem and ADT should be maintained

1 Like

I come from and still work on iOS apps so I currently use XCode for c++ “android” development. It’s got it’s issues of course, but every editor has quirks. It’s got auto-complete, jump-to-definition, and open anything (cmd+O). I do like the latest Android Studio since there is an Xcode key-binding setting.

I build and test with Mac and then do iOS (xcode), Win32/UWP (VMWare+Win10+VS2015 latest), as well as terminal + cocos compile (eclipse proj) for Android.

Hopefully XCode 8 out this week has some c++ improvements .

1 Like

@catch_up I think @OscarLeif answered your question. You can modify your project according the patch yourself without waiting next version of cocos2d-x to have a try.

@catch_up , I have the same questions with you. Have you managed to work on cocos2d-x without opening 2 android studio windows yet? I can’t find such a tutorial for that. And is there any way to compile without the cocos compile ?

You probably need this setup: Cocos2d-x Android Studio NDK build C++ DEBUG - WORKS!

so u able compile from run in android studio and modify c++ code

1 Like

Hey @sinhviencodon
I’ve been working in Eclipse only. And then later I realized that it’s the same as Android Studio. Where open, just one window for coding and use terminal for compile/build. This way, you’ll have only 1 window opened for studio.

Android studio is yet to mature for working with NDK(C++ cocos2d-x) I guess.

But yeah checkout @energyy solution too.

1 Like

Can refer to the ticket. Android Studio is working now.