How to use Android Studio with Cocos2d-x
Asked Answered
H

3

10

I work as an android programmer for just under a year now, and I just started to learn about android game development. The framework I choose to work with is Cocos2d-x.

I have seen guides and tutorials on how to use Cocos2d-x with eclipse, but I'd really like to know if it's possible to be used with Android Studio.

From what I've read, it is now possible to build NDK projects with gradle in Android Studio, which is good news. Nevertheless, I have yet to find any information about C++ programming using Android Studio. Eclipse uses the CDC ( https://www.eclipse.org/cdt/ ) plugin to achieve this.

Is there anything similar to be used with Android Studio? I have found some C/C++ enabling plugins for the IntelliJ Platform, but they were no longer updated.

Has anyone else tried this before? Did it work? Can you provide a step-by-step guide, for a newbie like me, who's dealing with this kind of problems for the first time?

Thank you for you time,

haxm

Humoral answered 1/3, 2014 at 9:13 Comment(1)
Well you can't write native code in Android Studio, but you can use native libraries. Write your cocos2dx in something else, build a library and import it into Android Studio. I actually like that process better, and as cocos2dx is a cross platform option, I think it makes more sense.Toting
P
4

Android Studio currently isn't well set-up for native programming. While the build system supports the NDK, there's no editor support for C++ files (it's not as if it won't work, but the IDE won't give you any editing assistance), and neither is there any debugging support. JetBrains has announced that they're working on new C++ support for IntelliJ, and this is something we're looking at for Android Studio, but it's not on the roadmap yet.

Pond answered 1/3, 2014 at 15:9 Comment(7)
Oh well, since then I've installed eclipse, set up the project and everything is running fine... A bit of a shame Android Studio isn't capable of this as of now. Thank you for your answer! :)Humoral
Can I use IntelliJ for native development? Can someone give me a hint, how to configure it?Clerkly
@Scott - has anything changed with the answer?Clingfish
Same question here, has anything changed?Exterritorial
No, nothing has changed.Pond
Scott is right, but one thing to add is you can use native libraries in Android Studio, so using Cocos2dx with Android studio is possible, just not writing cocos2dx with android Studio.Toting
@ stevebot What does that mean " using Cocos2dx with Android studio is possible, just not writing cocos2dx" ?Lorenelorens
C
1

Recent version of cocos2dx v3 (from github for example) have proj.android-studio project

At this moment I have no success to build it but maybe in future it will be fixed

Coronograph answered 12/6, 2015 at 6:27 Comment(2)
Actually I don't know about current status, I wrote my own gradle scriptCoronograph
so Scott Barta's answer is outdated ?Lorenelorens
K
0

I just went through the setup for this example code. The project compiles and has a ton of sample code. Scott Barta's answer still stands as an important caveat, but wanted to share the link in case it was useful.

I also found this useful for some NDK background/how-to.

Kemeny answered 26/10, 2014 at 21:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.