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

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

#1

How can I use Android Studio together with cocos2d-x? Any hints?
Android Studio link: [[http://android-developers.blogspot.de/2013/05/android-studio-ide-built-for-android.html]]


How do i edit and emulate code in android studio?
#2

Android Studio can import eclipse projects. I’ve not tried this.


#3

Sergey Shambir wrote:

Android Studio can import eclipse projects. I’ve not tried this.

Is there a ‘default’ eclipse project file for cocos2d-x which can be used together with Android Studio?


#4

Sergey Shambir wrote:

Android Studio can import eclipse projects. I’ve not tried this.

Is there a ‘default’ eclipse project file for cocos2d-x which can be used together with Android Studio?


#5

You probably need to wait a little bit.
Android Studio will create projects with the new gradle based build system. However the build system does not support the NDK at the moment.
According to Xav’s talk on the IO it will come in the near future.


#6

Yes, Android studio doesn’t support NDK yet. But it doesn’t prevent you from using cocos2d-x in it. (You can build cocos2d-x as a library first. Then use it in Android Studio.)


#7

There is one more way, Android Studio supports Maven. And Maven can build native android code. You can write your pom.xml and build right from studio with Maven, so the project is built whenever you press “Play” button. Anyway atm Eclipse is the best choice for me since I haven’t found out how to debug your native app in Studio while in Eclipse it’s possible with gdb.


#8

This needs to be revived. I am not sure about Android Studio’s adoption rate, but it’s much more suitable for Android development than Eclipse.


#9

Agreed!


#10

@Mazyod
I am not sure.
Why it is much more suitable for Android development?


#11

@zhangxm because it targets Android development specifically, and has tons of tools Android developers can utilize, eclipse simply lacks.

FYI, all the Android engineers I worked with up till now use Android Studio, and I am taking about some international studios even.


#12

Thanks.
We will do research about it.


#13

Android Studio RC3 released


#14

Hi Guys, any news about supporting Android Studio by cocos2d-x v3.0? Is there any main discussion thread with some working samples for current version of Android Studio?


#15

Here is the blog post i wrote on how to develop in Android Studio http://www.imaginenot.com/android-studio-and-cocos2d-x/


#16

I just imported a new project, called TestGame, an compiled it using ’ cocos compile -p android’. I tried to run it initially but got an NDK not found error so I added ‘ndk.dir=/Applications/Android/android-ndk-r10d’ to local.properties. Now I get this error:

Error:Execution failed for task ‘:testGame:compileDebugNdk’.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Applications/Android/android-ndk-r10d/ndk-build’’ finished with non-zero exit value 2

Has anyone copied the gradle example that supports NDK? The Google download link is broken.

Chris


#18

I had this same error and solved it. Try adding this to the build.gradle file of your main folder right after “defaultConfig”.

sourceSets.main {
    jni.srcDirs = []
}

#19

The brilliant X THANKS!

I changed the “Hello World” to “Hello Android” and recompiled the project at the terminal. I re-ran the project in Android Studio and still got “Hello World”. I guess I’m still not clear on how to incorporate the (C++) classes folder into the Studio project.

Chris


#20

Take into account that Android Studio won’t keep track of the folder where you have your original cocos project (like proj.android… ) and where you execute build_native.sh.

Your project has been imported somewhere else and that’s what Android Studio is executing. I think you will need to change the C++ classes there and then import the project.

I am sure there’s a faster/better way to do this and automate the process but I still don’t know how :smiley:


#21

Hello,
regarding the possibility to use an IDE for Android development with cocos2d-x, is there any recent tutorial on how to do it?
Thanks,

Fabrizio