====== Compiling for Android ======
Note: There are several ways to compile and publish MCServer for Android, this is only one way.

Prerequisites:
  - [[http://eclipse.org/mobile/ | Eclipse (for Mobile Developers)]]
  - [[http://developer.android.com/sdk/index.html | Android SDK]] Follow the tutorials on this site (it requires Eclipse)
  - [[http://www.cygwin.com/ | Cygwin]] (with all the gcc/g++ compilers and what not)
  - [[http://developer.android.com/tools/sdk/ndk/index.html | Android NDK]]

This tutorial expects you to have above mentioned programs fully configured and working together before continuing.

===== Creating the binary =====

Open up Cygwin and change the current directory to the Android folder in the MCServer repository

{{:compiling:android_step1.png|}}

Then issue the build command ''ndk-build'' to compile the MCServer sources into a native library (a .so file). Additionally you can use the parameter ''-j<number>'' to use multiple compile processes to increase compile speed.

{{:compiling:android_step2.png|}}

===== Adding the MCServer project to Eclipse =====

Open up Eclipse, then go to ''File > Import..''

From the dialog choose ''General > Existing Projects into Workspace''

Then set the root directory as the Android directory in the MCServer repository and tick the box for the MCServer project.

{{:compiling:android_step3.png|}}

===== Exporting the APK file =====

To export the .apk file you can install on your Android device, rightclick the MCServer project in the Package Explorer (left side of the screen) and select ''Export..''. 

In the dialog choose ''Export Android Application''. 

Select the MCServer project.

Choose an existing keystore or create a new one.

Select the destination APK file and click Finish.

The resulting .apk file can be distributed on most Android devices, good luck!