Hi again! If you’ve been able to accomplish the first one, and you’re aim to continue, thi is the second part. In this part, we’re going to run the TestCpp project of Cocos2dx in Android. It’s going to be shorter process than the previous one.
Before we start with the Android part, I want you to try to make a debug against the HelloCpp project in eclipse. In Debian I had a problem. My eclipse said “Error while launching command: gdb –version”. After a while I realized that I hadn’t installed it, http://www.gnu.org/software/gdb/ and it’s necessary for debugging, so sudo apt-get install gdb.
Let’s start with Android. We have to define a couple of enviroment variables inside our eclipse. The first one, COCOS2DX must be defined in Eclipse->Preferences->General->Workspace->Linked Resources. Click in the New button and set the variable to the path of the uncompress folder of Cocos2dx, in my case /home/borja/Programas/cocos2d-x-2.1.4.
The second one, NDK_ROOT, must be defined in Eclipse->Preferences->C/C++->Build->Environment. Click in Add and set the variable value to the path of the uncompress folder of NDK, in my case /home/borja/Programas/android-ndk-r8e.
If you’re compiling the TestCpp project with the last version of Android like me, maybe the NDK shows this error android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml. You can work around it by modify the file add_application.mk in the line 128, changing $(call __ndk_warning by $(call __ndk_info.
Now, try to compile the TestCpp project, you should get an output console like this, but a little much longer :-).
21:30:17 **** Build of configuration Default for project TestCpp ****
NDK_ROOT = /home/borja/Programas/android-ndk-r8e
COCOS2DX_ROOT = /home/borja/Programas/cocos2d-x-2.1.4/samples/Cpp/TestCpp/proj.android/../../../..
APP_ROOT = /home/borja/Programas/cocos2d-x-2.1.4/samples/Cpp/TestCpp/proj.android/..
APP_ANDROID_ROOT = /home/borja/Programas/cocos2d-x-2.1.4/samples/Cpp/TestCpp/proj.android
Using prebuilt externals
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
make: Entering directory `/home/borja/Programas/cocos2d-x-2.1.4/samples/Cpp/TestCpp/proj.android'
Compile++ thumb : cocos_testcpp_common <= ExtensionsTest.cpp
Once the building process has finished, launch the app normally in an Android device, and everything should work well.
Thanks for read this. The new group of post that I’m going to write, will be about setup a continuous integration environment in general and for Android particulary.
See you soon!