A bit tired of setting up cocos-2d Android

Ok, I am pretty frustrated.

I am trying to get a port from Sprite-kit, to Android going before next Saturday, but I cant even get cocos2d going!

I have tried twice now with two different tutorials and almost always get stuck at some error that on forum posts everywhere has yet to have a resolution that fixes it for me. Generally this is because the new ndk has a linking issue, or google now shoves android studio in your face and hides the sdk and tools. Basically all of these tutorials seem to only work if you have the magical versions of everything that existed at the time of creation… now (idk it could just be me) but things just dont seem to be working!

Anyway I was hoping for a suggestion of what tutorial I can try next. Preferably the tutorial would come with all of the SDK, NDK, etc. files that were used in the tutorial so that I dont have to use updated ones. I would prefer a print one, but it has to be thorough.

Any ideas?

I have given up on the last attempt because eclipse started to go really wacky which compouneded the other issues, however if try 3 doesn’t go well I will be asking for help if that is ok.

P.S this is the tutorial I used this last time it is from 2015 which is pretty recent, however a lot of things have changed versions and placements.

Well, have you gone through these tutorials?

http://cocos2d-x.org/docs/installation/B/

and

http://cocos2d-x.org/docs/installation/C/

If you are running into trouble, we also need to know what is going on. I get you are frustrated, but without seeing an error or screenshots or something, I’m not sure how to help more.

The tutorial you link to is not an official tutorial, so I cannot say for sure if it works or not.

Could you provide sdk, ndk version which should be use together with cocos2dx.3.11?
For example latest ndk fails with “cocos gen libs -p android”

Regards
Chp

Let confirm with the engineering team to make sure I give accurate info.

Also, can you ask about the best versions that vork with 3.10? Thank you

sure thing.

It would be good to put this information in release notes

and I’ll update our installation docs too :slight_smile:

What is meant by “Android Studio Bundle” should I get the android studio exe? Sdk tools exe?

EDIT: I found it tucked away at the bottom of the page, it appears to be an exe… I assume it just unzips it for me

You should prefer apache ant version 1.9.6
android ndk version 10

And its not that tough to install, I will be linking the youtube link where it has been installed.
the version might be different but this way works.
https://www.youtube.com/watch?v=xqtT0E68TJM

That might be just a warning kind of thing. Try to compile it before and the run it.
Even if it might be showing “Please use cocos console instead” the programs runs well.

I was also getting the same message when I was using eclipse for cocos2dx game development.

This might be because your apk files are not getting generated properly.
Look at the size of your apk, it must be in kb

There must be some error in your code because of which this issue is coming.

If your problem is not getting solved then send me your souce code in .zip format.
I will check that.

1 Like

you are using windows?

I don’t use skype on regular basis.
I will help you here and get your code running.

1 Like

yeap using window

Do one thing…

Go into your project directory through cmd.
then compile your project using this command “cocos compile -p android --android-studio”

It will take some time and finally a new folder will get created in your project director name “bin” then open that folder and you will get your .apk file there.
copy it on your phone and install it.

First of all add path of sdk and ndk in environment variable(You must have already done that).
Sdk version is 22. It is the best version to use with cocos2dx.
ndk version is 10. I was using version 9 till few weeks earlier but now cofigured it to 10.
environment variable ex:
ANDROID_SDK_ROOT - C:\Cocos\Android SDK\sdk
ANT_ROOT - D:\Cocos_Setup\apache-ant-1.9.6\bin
NDK_ROOT - D:\Cocos_Setup\android-ndk-r10e-windows-x86_64\android-ndk-r10e

you can use the path where you have stored these data.

After that make a new project using console:
cocos new AnyName -p com.anything.AnyName -l cpp -d C:\AnyDirectory

Wait a minute and it will create new project.

Then go into your project directory(AnyName) find foder named android type cmd in address bar then run the command build_native.py
It will take some time and you will get the message Build Successful.
Then go into your Project folder then folder named “bin” and you will find “AnyName.apk” there. Install it.

Hurray! I got it working! Thanks for your help!

What is the size of that apk?

Which IDE you are using…
Visual Studio or Android Studio?