Skip to content

Diablo World Client – Diablo World Android APK Compiling Flow Detailed Tutorial

9miao Mobile Game edited this page Aug 25, 2014 · 1 revision

Diablo World Client – Diablo World Android APK Compiling Flow Detailed Tutorial

You can find previous published documents about development environment build. If you have questions and doubts, please feel free to ask question in our forum at any time: http://www.9miao.com/forum.php, our worker will promptly answer your question. This document focuses on using Android to compile in eclipse.

First we need to import Diablo World source code into eclipse and start to prepare for compiling. Here firstly write .cpp file in Classes and relevant folder path into eclipse, open Diablo World project in eclipse, open jni folder to find Android.mk, and double click it.

Then write in all names of .cpp file in order, it’s shown below (a part of .cpp file):

Admittedly this manually fill-in method is very troublesome, however, we can automatically generate all .cpp file list by using a shell script, and you can find the script in this document’s attachment. How to use this script: open cmd, input the below command in order:

_cd $COCOS2DX_ROOT // _ enter cocos2d-x root directory
ls // list all directories, find projects
cd projects // enter projects directory
ls // find Diablo World source code, enter proj.android directory
cd tsDemo //...
ls //...
cd proj.android //...
ls //...
cd jni //...
ls // enter this directory and you will see a list.sh file in the list
./list.sh ../../Classes // use .cpp file list of Classes that listed by list.sh

You will see the below list after it has been successfully run, the below image is part of the list:

Copy all the generated .cpp lists, and paste them into the corresponding locations in android.mk.

Then we need to add some files from Classes, the detailed locations is as follows:

Note: the purpose of adding folder path is to find Classes codes, so an incomplete path is OK. However, we must add the default path in IDE (such as in Xcode).

Now the preparation work is finished, we can start to compile code. Right click project Run As->Android Application to compile, but system might pop up an error report ‘Can't find NDK.Please define NDK’. If this happens to you, you need to manually add NDK into project Project->Properties->C/C++ Build->Environment, click ‘Add’ on the right zone, input ‘NDK_ROOT’ in name column, and then write in your own NDK path in Value.


With all problems are solved, you can start to compile now, it will take you quite some time.(if you run into any problems during the compiling process, be sure to post on forum, our worker will timely answer your question). You will see the generated .apk installation package in bin directory of project after compiling, it’s better to install this .apk in real machine if you want to see operating result, the speed of android own simulator is far away from our need.

Run->Run Configurations->Android Application->tsDemo, select ‘Target’, and select ‘Always prompt to pick device’, thus every time it will automatically recognize your device to install after you connect your real machine.

It might be displayed in a landscape mode after the program is running, so you need to manually modify android configuration file. Find AndroidManifest.xml in bin directory, open it and you will see many items (you can search for the meaning of each item on internet, there is no further explanation), find ‘android:screenOriention’ and modify its value into ‘portrait’, thus you could correctly run the program.

Open strings.xml in res\values, you can set version number in ‘version’ and modify installed apk name on device after string tag. There are some other folders in this directory, judging from the folder name we can tell that they are prepared for placing different resolutions apk icon.

Clone this wiki locally