@milos1290 your link is broken
We have a video tutorial on this https://www.youtube.com/watch?v=gdOkbXYsf04&index=9&list=PLRtjMdoYXLf7fqFlzHJvfhBgO0ddEm-k5
@SonarSystems Thatās a great video, thank you! (also for all the other video you made)
I just started developing with Cocos, so at many things Iām still trying to figure out how to do it. The biggest question I currently have is whether it is possible to step-through-debug Cocos Code with Android Studio. I guess it is not, so Iām currently thinking about using Visual Studio, running the proj.win32 Code (which is beautifully debuggable) and once in a while have a look on an actuall smartphone device. What is your thought on that workflow?
I would use Android studio only for running and use another IDE of your choice for development and debugging.
Thank your for your fast respond. I will try it out.
Iām looking forward to a great collaboration with everyone in this forum!
Thatās how I work. I spend 95% of my time in VS, then just do the OS specific stuff in XCode, Eclipse or Android studio.
I like to work in Linux some time too, but Iāve not found an IDE that compares to Visual Studio, so Iāve got to stick with Windows for now
Iād quite like to setup Visual Studio to do my Android and iOS builds, but Iāve not looked into how hard it is to setup yet. Has anyone tried it with Cocos2D-X?
When you say Iād quite like to setup Visual Studio to do my Android and iOS builds,, are you saying you want to actually build and run iOS and Android from VS?
Yeah. Itās a new feature of Visual Studio 2015. You can build Windows Phone, Android and iOS. It even has its own Android Emulator.
I think it still requires a Mac with XCode running on your network to compile the iOS code, but itād still be nice to do everything from the same tool.
Thatās very interesting, defo will try this.
Youāll have to make a video if you figure out how to get it working with Cocos2D-X. Iāve found your videos very useful
Android studio support should work with new gradle experimental plugin which claims to offer full NDK support
and Android Studio 1.3+ (which includes JetBrainsā CLion, a C++ IDE). However I wasnāt able to configure it to recognize cocos2d-x, I keep getting linker errors while building the project (āno such file or directory spine/BoneData.hā etc). Iāll keep trying and, if succeed, will publish a github repository with sample project.
I was able to get at least basic C++ highlighting and navigation by creating symbolic links to cocos2d
and Classes
directories (this of course only works for Linux and Mac):
$ cd proj.android-studio/app/jni
$ ln -s ../../../Classes
$ ln -s ../../../cocos2d
I compile the native code using cocos
command line interface
$ cd proj.android-studio/
$ cocos compile -pandroid --android-studio --no-apk --app-abi x86
and run the app from Android Studio. Not the ideal workflow but at least I can edit all C++ code and java code from a single Android Studio project. One can go even further and configure a pre-build rule in Android Studio to execute the above cocos
command before every build automatically.
We may have to
Itās Great a suggestion. Do you have a suggestion for auto run and compile cocos compile ? Thanks @denisk20 itās really help
-
Create a new External Tool configuration in Android studio (
File -> Other Settings -> Default Settings -> Tools -> External Tools
, then click+
at the bottom). Assuming that you havecocos
command-line tool installed, fill in the form similar to this:
-
Go to
Run -> Edit Configurations
, then select your runtime configuration, scroll to the bottom to reveal āRun Afterā table, click+
, selectRun External Tool
, then select external tool that you have created on step 1:
Now every time you run your configuration you will run cocos build too. Havenāt fully tested it so maybe some tweaks are required.
Thanks @denisk20 this was a big help. I did have to use $ProjectFileDir$ vs $ModuleFileDir$ in order to get CppTests to compile with Android Studio.
Hi,can i debug c++ on android studio?
@yixiaoqingyuz Currently I think you canāt, but it should become possible once they finish full NDK support in Experimental plugin. The steps from post #34 wonāt be necessary then.
I thought android studio had full NDK debug support by now - am I wrong?
But running console ācocosā command from android studio is just a shortcut. You can use any text editor and just run it straight from console. Itās not the solution we need. For now I write all code in xcode and just run android app from console.
Whatās important it should use gradle, which does all the job. Then we can easily use multidex or import parts of google-play-services (like admob) not whole library. These days hitting 65k method dalvik limit is very easy. Also we should be able to use ndk debugging. Then I guess we can also create a ātemplateā for android studio, so itāll even be able to create cocos2d-x projects (but thatās not necessary important).
Have a look to my post.
I am trying to build cocos2dx using gradle and full NDK support. Any help would be very apreciated.