Difference between revisions of "Android"

From Minetest Developer Wiki
Jump to navigation Jump to search
m
 
(54 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= Building and Running =
+
= Building Android =
== Building ==
 
What you need:
 
* Linux
 
* Android NDK '''Crystax version''' (with <code>android_native_app_glue.h</code> copied into <code><TOOLCHAIN_ROOT>/sysroot/usr/include</code>)
 
* Android SDK
 
* Android device
 
* Git
 
* CMake
 
* Ant
 
* ADB (optional but very useful)
 
=== Irrlicht ===
 
Clone <code>https://github.com/sfan5/irrlicht-android</code>.
 
  
Make sure you have arm-linux-androideabi-gcc and arm-linux-androideabi-g++ usable and run <code>make</code> in <code>source/Irrlicht</code>.
+
See https://github.com/minetest/minetest/blob/master/doc/README.android
 
 
This will build Irrlicht as static and shared library and place it in <code>lib/Linux</code>
 
 
 
=== Minetest ===
 
Clone <code>https://github.com/sfan5/minetest.git</code> and switch to the <code>android_new</code> branch.
 
Configure it using CMake like this:
 
<pre>
 
$ cmake . \
 
    -DCMAKE_C_COMPILER=`which arm-linux-androideabi-gcc` \
 
    -DCMAKE_CXX_COMPILER=`which arm-linux-androideabi-g++` \
 
    -DCMAKE_FIND_ROOT_PATH=<sysroot of your android toolchain> \
 
    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
 
    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
 
    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
 
    -DCMAKE_SYSTEM_NAME=Linux \
 
    -DIRRLICHT_LIBRARY=<path to libIrrlicht.a> \
 
    -DIRRLICHT_INCLUDE_DIR=<path to include/ of Irrlicht> \
 
    -DANDROID=1 \
 
    -DRUN_IN_PLACE=1
 
</pre>
 
Now just enter <code>make package</code>.
 
After make is done go into the <code>Android</code> directory and run <code><SDK_DIR>/tools/android update project --path .</code>.
 
 
 
Then copy the .so using <code><NDK_DIR>/ndk-build</code> and build the apk using <code>ant debug</code>.
 
 
 
You will then have the resources in minetest-''x.x.x''.tar.gz and the apk at <code>Android/bin/Minetest-debug.apk</code>.
 
You will only need to do the "android update project" step once.
 
== Running ==
 
For this step you need minetest-''x.x.x''.tar.gz and Minetest-debug.apk from the previous step.
 
 
 
Put all resource files & folders (builtin, client, ...) into <code>/sdcard/minetest</code> on your Android device.
 
Install <code>Minetest-debug.apk</code>.
 
 
 
Now touch the Minetest icon and the lovely main menu should appear. ;-)
 
 
 
= Dev Notes =
 
== General notes ==
 
* cURL does not work
 
* Add Bluetooth support for local multiplayer? (probably requires use of Java)
 
== Moving away from Crystax NDK ==
 
=== Situation ===
 
NDK seems to be unmaintained, would be good if we could move away from it.
 
* Builds with small tweaks to the code
 
* Works, but everything that goes through wchar_t is messed up
 
=== Ideas ===
 
* use Android's support library (verify if it does support locale stuff good enough)
 
* use uClibc
 
==== Android's support library ====
 
pro:
 
* Do not need to depend on more (Android-)external libraries
 
* (Probably) Tuned for usage with Android
 
contra:
 
* -
 
==== uClibc ====
 
pro:
 
* Completely independent from Android -> avoids upcoming problems in Android
 
* Also fixes some other problems we have with the libc
 
contra:
 
* Increases executable size (uClibc is pretty small, this does not really count)
 
* OpenGLES / Android libs may not work (verify this!)
 

Latest revision as of 19:42, 18 June 2022