The instructions in this article were written for and tested on Linux,
but the tools used here should also work on other platforms.
You can build Luanti for Android either using CLI tools or Android Studio.
## Prerequisites
- Basic familiarity with the command line.
- You have a working network connection.
- You have already downloaded / cloned a copy of Luanti to a folder called `luanti`.
- You have an Android device you want to install Luanti on for testing purposes
or you want to produce a Luanti release build for distribution.
## CLI tools
### Setup
You should have a recent version of OpenJDK installed (17 should be enough).
Download the command line tools from the [corresponding section on the Android Studio downloads page](https://developer.android.com/studio#command-line-tools-only).
Then extract it into an empty folder with the structure being as seen below.
The `android-sdk` folder will then become your SDK folder.
```
- android-sdk/
- cmdline-tools/
```
Then open a terminal in `android-sdk/` and run the following command to accept the licenses for the SDK.
Accept the licenses that you definitively should read carefully.
_(On Windows, if the above doesn't work, try running the command `sdkmanager --sdk_root="<path to the folder you want to install SDK tools to>" "platform-tools"`. You will likely need to add this path to your [PATH environment variable](https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/), so PowerShell can recognize the installed components.)_
### Building
Optional: First figure out the ABI of the device you wish to build for
and disable all other ABIs to significantly reduce build times.
(See [here](/for-engine-devs/compiling/improving-build-times/#android-disabling-unused-abis) for details.)
Luanti uses a [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html),
which makes building Luanti for Android very easy: You just run
```sh
cd luanti/android
./gradlew app:assembleDebug
```
If the build is not working, try first cleaning the cache via `./gradlew clean` before building.
_(If you're compiling on Windows, you can use the `gradle` command, so long as you install the additional Unix dependency [gettext](https://www.gnu.org/software/gettext/). Both of these are verified to work when installed by [Scoop](https://scoop.sh).)_
This will produce a number of debug builds in the form of `.apk` files (depending on the enabled ABIs)