The workflow to run the Cocos2D-x projects on Android is as follows:
- Open the project in Eclipse (File > New Android Project > Create project from existing source, select the android folder from your project folder)
- Open a terminal and navigate to the android folder, run
- When that’s done, switch back to Eclipse and clean the project (Project > Clean)
- Right click the project and select Run As > Android Application
At this point if your Android device is connected, the app should automatically be deployed to it if the API versions match.
If you do not have an Android device, now’s a good time to configure a new Android Virtual Device (AVD).
Every time you modify the source files you are going to need to run build_native (step 2) in the terminal and then clean the project in Eclipse (step 3). Cleaning the project will force Eclipse to refresh the bundle files and take into account the newly compiled code when creating the game APK.
By default, the
create-android-project.sh wizard will not set the min SDK version in the manifest file. It is a good idea to have that set so open up the
AndroidManifest.xml file and set it to the oldest version that you want to support. I usually go with SDK version 7 (Android 2.1-update1).
If you want to manually edit the XML file you will need to add the following line right above the
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7"></uses-sdk>