To compile for android studio there was a new flag added for cocos commandline.
Try this:
cocos compile -p android --android-studio
To compile for android studio there was a new flag added for cocos commandline.
Try this:
cocos compile -p android --android-studio
Tomorrow we will be creating a setup video for Cocos2d-x v3.7 with Android studio§
Did you make the video? Can you share the link please?
Thanks!
We have not made it yet but will be very soon.
Great
Put also some part of integrating some third party SDK’s, thru gradle
+1 for the integration. I’m having trouble with simple plugin compilation (no code integrated yet, just module compilation).
See my post here: [Android Studio] NDK not configured when cocos plugin is used
Thanks!
First video will be just setting it up and getting it working but more videos will follow as per usual
It would be great to explain the basic principles how AndroidStudio co-exists with cocos console and with android make files.
What is actually used by the compilation. Gradle configs or the Android make files?
What is the configuration life-cycle? Where do I make configuration changes: android makefiles, gradle configs, android studio settings? When/what do I synchronize?
What is the proper way of importing dependent modules e.g. Facebook plugins?
a. When I’ve imported the plugin then AndroidStudio copied all the
Java files to proj.android-studio
folder. I’ve ended up with extra folders libPluginFacebook and libPluginProtocol. This might be desirable
but not always. Sometimes you want to shared the big dependencies.
b. where do I set the classpath? When I compile the project the I receive compilation errors shown bellow. You can see that compiling libPluginProtocol
is completed and now I’m receiving the errors from libPluginFacebook:compileReleaseJava
where most of them relate to dependencies to libPluginProtocol
. Where do I set it? Is not sufficient to say that libPluginFacebook
depends on libPluginProtocol
?
Mentioned compilation errors:
Skipping task ':libPluginProtocol:assembleDebug' as it has no actions.
:libPluginProtocol:assembleDebug UP-TO-DATE
:libPluginProtocol:assembleDebug (Thread[Task worker Thread 3,5,main]) completed. Took 0.001 secs.
/pp/src/tests/testAS/TestAS/frameworks/runtime-src/proj.android-studio/libPluginFacebook/src/main/java/org/cocos2dx/plugin/FacebookWrapper.java:7: error: cannot find symbol
import com.facebook.AppEventsLogger;
^
symbol: class AppEventsLogger
location: package com.facebook
/pp/src/tests/testAS/TestAS/frameworks/runtime-src/proj.android-studio/libPluginFacebook/src/main/java/org/cocos2dx/plugin/FacebookWrapper.java:8: error: cannot find symbol
import com.facebook.UiLifecycleHelper;
^
symbol: class UiLifecycleHelper
location: package com.facebook
/pp/src/tests/testAS/TestAS/frameworks/runtime-src/proj.android-studio/libPluginFacebook/src/main/java/org/cocos2dx/plugin/FacebookWrapper.java:9: error: package com.facebook.widget does not exist
import com.facebook.widget.FacebookDialog;
Thanks a lot for giving some light into all this!
–Josef
Thanks!! I had the same problem but this command line solve it!!!
Hello, do you have a progress on the videos? Perhaps it is done and we don’t know where to find them…
Is there any document describing the cocos/Android Studio cooperation?
There is much more questions like the above and still un-answered…
Thanks!
No we haven’t created the video yet, been busy on other Cocos2d-x endeavours but will look at it soon.
We have created the Android Studio video, it is uploading right now and we will post a link very soon
Here it is, Cocos2d-x Android Studio video tutorial:
http://www.sonarlearning.co.uk/questions.php?question-topic=300
thanks, just wanted to blame on you that you doing this video to long as this is is most useful feature of 3.7 cocos.
Ok, watched video - why you not adding gradle command which will execute “cocos compile …” in command line automatically when you press run in Android Studio, so you nod need to run separately this command in terminal.
I tried to compile my app using the instructions in your video. Compilations does not succeed because of the following error:
make: Entering directory
/Users/power/Documents/Projects/spacegame/proj.android-studio/app' /Applications/android-ndk-r10c/build/core/build-binary.mk:449: warning: overriding commands for target
obj/local/armeabi/objs-debug/bullet_static/BulletMultiThreaded/SpuLibspe2Support.o’
/Applications/android-ndk-r10c/build/core/build-binary.mk:449: warning: ignoring old commands for targetobj/local/armeabi/objs-debug/bullet_static/BulletMultiThreaded/SpuLibspe2Support.o' make: *** No rule to make target
jni/…/…/Classes/AppDelegate.cpp’, needed byobj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/AppDelegate.o'. Stop. make: *** Waiting for unfinished jobs.... [armeabi] Compile++ thumb: cocos2dcpp_shared <= main.cpp make: Leaving directory
/Users/power/Documents/Projects/spacegame/proj.android-studio/app’
Error running command, return code: 2.
What rules are they talking about ? My app compiles for android fine (if I run cocos compile -p android).
The command line build works for a new project. But doesn’t seem to work for my existing project. Where should the rules for making the target be added?
I copied all the files listed in Android.mk in proj.android to Android.mk in proj.android-studio.
Otherwise the files look similar. Any changes to be made ?
EDIT: The problem was that the paths I specified in Android.mk for proj.android-studio was incorrect. As it is one more folder down, I should have put …/…/…/ instead of …/…/ . Its compiling now. But its taking forever for android studio to open.
Hi,
I’ve just downloaded v3.7, yesterday. However when I tried to create new project with command line tool or even with Cocos app, I don’t see any project names proj.android-studio
Is it removed from latest version ?
Regards,
I’m using 3.7 right now. It is not removed. I create a new project by doing:
cocos new MyProjectName -p com.chumbyfuzz.myprojectname -l cpp
Make sure, you really using 3.7 console not older version.
What version of Cocos2d-x was used to create your project?