Not sure how to compile for Android

I’m not sure if it’s because 3.0rc0 just came out, or what, but there seems to be almost no consistent guide to compiling for Android.
I think what I’m supposed to do is add all of the cpp files to the Android.mk src file and then run build_native.py. As far as I know, I’ve got all of my environment variables set up correctly, and build_native.py doesn’t seem to have any errors.

It has two warnings that are both, “LOCAL_LDLIBS is always ignored for static libraries”, and then says “[armeabi] Install : libcocos2dcpp.so => libs/armeabi/libcocos2dcpp.so”
then “make.exe: Leaving directory ‘[file path]/proj.android’” and that is the last thing it says. The script doesn’t seem to finish either as the window just stays open.

I’m not really sure what is supposed to happen, but from what pieces of documentation I have found, (usually talking about build_native.sh) it seems that the script should be creating the apk, which is definitely not happening.

If there is an updated guide, or something, that would be great, because I’m just taking shots in the dark here.

Edit: Please forgive me if anything I say is wrong, I’ve only just tonight managed to get my own game running on android and I’m just trying to help :slight_smile:

As far as I understood it this evening, you’ve basically succesfully compiled your c++ project.

The next step is to start up Eclipse (Android toolkit), import your android project, and compile it in Eclipse, after which you can run it in Eclipse in either a virtual device (emulator) or on a connected android device like a phone, if you have installed the device drivers correctly and set the phone to development/debug-mode.

Basically the build_native.py script compiles the c++ code, and in Eclipse you compile the Java code that imports the compiled c++ code.
If you make changes to your c++ code, you need to run the build_native.py script and then compile the project in Eclipse.
I thought compiling the project in Eclipse would make it all work, but none of my c++ code changes showed up… so then I figured out it’s a 2 step process.

Okay, I think I actually tried that… I did at one point manage to generate an apk, I’m betting it was through this process, but the apk did not run on either an emulator or device. Is there anything else I need to do? Maybe I did something wrong with the resources?

define “did not run”…

What error messages did you get ?

I finally figured it out. Noticed in the logcat that it wasn’t finding Cocos2dxHelper.cpp, so I copied the folder that that file is in from the cocos2d root to my project src and now it compiles fine.

Pretty strange that, if that is actually necessary, it doesn’t get copied automatically by the project generator script.

Thanks for your help!