Note: This is a request for an enhancement of the emacs version 30 documentation. I am writing this submission in emacs 29.1, so the current environment details are irrelevant.

I needed to build and run the Android emacs APK, to try and track down a bug. As I am a novice regarding building Android apps, finding out how to do this required considerable effort. I therefore suggest that information similar to what I include below, is added as an appendix to java/INSTALL.

First I suggest that the emacs repo top level README or INSTALL should include a reference to java/INSTALL. Perhaps something like this:

Here is now my build and run instructions:

I am using Ubuntu, so these instructions are Ubuntu specific, but should be easily adaptable to other linux based distributions. Note that Android Studio, Android SDK, Android NDK can be downloaded from the software provider, if they are not available in your linux distributions package manager.

I first installed Android Studio. It is available in the Ubuntu snap store:

I then ran Android Studio to set it up, and also tried to build a sample project. I believe that at this point $HOME/Android with important subdirectory $HOME/Android/Sdk/build-tools/33.0.1 was added to my $HOME directory. See below why this was important.

I then installed a number of apt packages:

Not sure if package crossbuild-essential-arm64 is needed.

The SDK was installed under /usr/lib/android-sdk. The NDK was installed under /usr/lib/android-ndk.

The sdk supports creating Java based apps. The ndk supports creating apps using C or C++ source.

Now something important: The sdk installation created, among other things, a directory /usr/lib/android-sdk/build-tools/debian. I tried building with that, but this did not work, as the contents of the directory is very incomplete. That was when I discovered $HOME/Android, and the important directory $HOME/Android/Sdk/build-tools/33.0.1. Using that directory instead of the debian directory, I was able to make a successful build.

I added a number of directories to my PATH, but I do not know if that is necessary: if [ -d “/usr/lib/android-sdk/tools/bin” ] ; then PATH=“/usr/lib/android-sdk/tools/bin:$PATH” fi if [ -d “/usr/lib/android-sdk/platform-tools” ] ; then PATH=“/usr/lib/android-sdk/platform-tools:$PATH” fi if [ -d “$HOME/Android/Sdk/build-tools/33.0.1” ] ; then PATH=“$HOME/Android/Sdk/build-tools/33.0.1:$PATH” fi if [ -d “/usr/lib/android-ndk” ] ; then PATH=“/usr/lib/android-ndk:$PATH” fi

To install cross compilers for android I now did:

Installed under “/opt/android-sdk//platforms/android-33”. ANDROID_CC are under /usr/lib/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

I then ran the following in the top directory of the emacs repo:

./configure –with-android=/opt/android-sdk/platforms/android-33/android.jar \ ANDROID_CC=/usr/lib/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang \ SDK_BUILD_TOOLS=$HOME/Android/Sdk/build-tools/33.0.1

make all

To run the emulator I started Android Studio, and in the menu in the upper right corner selected “Virtual Device Manager”. I could then select and run the default emulator device “Pixel_3A_API_34_extension_level_7_x86_64”. To load the APK into the emulator I started a file manager and dragged and dropped the APK file onto the emulator display. The computer keyboard can be used for typing into Android emacs.