Android Debug Bridge (ADB)

adb is a client tool that can be used to copy files to and from an Android device, sideload apps, and flash custom ROMs. When the client is used, the adbd daemon will start automatically on the computer to faciliate sending commands to an Android device which will also be running a server.


  • Arch Linux:

    $ sudo pacman -S android-tools
  • Debian:

    $ sudo apt-get update
    $ sudo apt-get install android-tools-adb
  • Fedora:

    $ sudo dnf install android-tools

On the Android device, enable developer options.

  • Settings > About phone > (tap “Build number” 7 times to enable Developer options)

Then enable debugging mode.

  • Settings > Additional settings > Developer options > USB debugging: on

  • Settings > Additional settings > Developer options > Wireless debugging: on

Verify that ADB is working.

$ sudo adb devices
List of devices attached
<UUID>    device


Bootloader Unlock

An unlocked bootloader is required to install a custom ROM. It will do a factory reset of the device so back up any data before proceeding.

  • Allow the bootloader to be modified.

    • Settings > Additional settings > Developer options > OEM unlocking: On > Enable

  • Reboot into the bootloader and then verify that it can be accessed via ADB.

    $ sudo adb reboot bootloader
    $ sudo fastboot devices
    <UUID>    fastboot
  • Unlock the bootloader.

    $ sudo fastboot oem unlock
  • Setup the phone again and then re-enable ADB debugging support.


Custom Recovery Image

A custom recovery image is required to be setup to allow installing custom ROMs.

  • The latest Android devices use A/B partition schemes this is not compatible with most ROMs such as LineageOS. Additional partitions need to be downloaded and flashed.

    $ sudo fastboot flash dtbo dtbo.img
    $ sudo fastboot flash vendor_boot vendor_boot.img
  • Flash a custom recovery image and then reboot to load up the new partition(s).

    $ sudo fastboot flash boot boot.img
    $ sudo fastboot reboot
  • Go to the “Recovery mode” of the device and then format all of the data.

    • Factory reset > Format data/factory reset > Format data

Custom ROM

A custom ROM can finally be installed after the bootloader has been unlocked and a custom recovery image has been flashed.

  • Flash a custom ROM. LineageOS provides the most stable ROMs due to their focus on being close to upstream Android and strict working hardware requirements. [8]

    • Apply update > Apply from ADB

      $ sudo adb sideload <ROM>.zip
  • If the Google Play store will be installed, it has to be installed now and cannot be added later. It is part of the initial setup of the device. The device needs to first exit and re-enter the recovery mode to load up the new ROM changes.

    • Advanced > Reboot to recovery

    • Apply update > Apply from ADB

  • Download MindTheGapps for the relevant version of Android.

    $ sudo adb sideload MindTheGapps-<VERSION>-<ARCHITECTURE>-<BUILD_DATE>-<BUILD_NUMBER>.zip
  • Finally, select “Reboot system now” to boot into the ROM.


App Stores

Amazon Appstore

The Amazon Appstore is found on Kindle devices and can be sideloaded on other phones as well. It is the second largest Android app store behind Google Play. [13] It hosts free and paid apps.


APKUpdater is not an app store but provides functionality to update local apps. It checks other app stores for updates that it can download. Those app stores include: APKMirror, Aptoide, F-Droid, and Google Play. [14]


Aptoide is a community-driven app store. All apps on this platform are free but not necessarily open source.


F-Droid provides a collection of free and open source apps.

Google Play

Google Apps (GApps) provide a collection of applications including Gmail, Google Calender, Google Maps, Google Play Services, Google Play Store, and more. Only officially licensed Android phones have these. The Google Play Services adds additional APIs to help update the functionality of Android without a full operating system update. [3][4]

Devices without this can still sideload the Google Play Store and related dependencies. Download and install these applications in order from first to last [5]:



The Google Camera (GCam) app is exclusive to Google Pixel phones. It offers better picture quality over the stock Android camera app.

GCam can be installed on any Android device that supports the Camera2 API.

  • Use can app such as “Camera2 API Probe”, “Camera2 Info”, or “- Camera2 Test -” to verify the hardware support for the Camera2 API. The device must have either “FULL” or “LEVEL_3” hardware support.

  • Install the “Google Photos” app as this is required to preview photos in the GCam app.

  • Download and install GCam for the relevant Android version of the device from here.


Google Meet

Google Meet can be used for audio and/or video calls. The audio codec used is Lyra which is very data efficient. [9][10] That codec uses a low birate when uploading from the sender. On the receiver side, it uses artificial intelligence to enhance the audio quality. Lyra 2 came out in 2022 which can use a minimum bitrate of 56 kbps. [11] The codec is automatically used when low bandwidth is detected. [12]


Termux (PRroot)

Termux is an app that is available from F-Droid. The app hosted on the Google Play Store is no longer recommended as it is very outdated and unmaintained. [20] Termux provides a CLI tool known as PRoot Distro. PRoot allows a non-root user to access and use a chroot environment. It supports setting up the following Linux distributions:

  • Alpine Linux

  • Arch Linux

  • Debian

  • Fedora

  • Manjaro

  • OpenSUSE

  • Pardus

  • Ubuntu

  • Void Linux


  • View the current list of supported Linux distributions:

    $ proot-distro list
  • Install the proot-distro CLI tool.

    $ pkg install proot-distro
  • Install a Linux distrubtion. By default, it will use an alias that is the same name as the Linux distribution. That alias can be changed during install or renamed later.

    $ proot-distro install <LINUX_DISTRO>
    $ proot-distro install --override-alias <ALIAS> <LINUX_DiSTRO>
    $ proot-distro rename <OLD_ALIAS> <NEW_ALIAS>
  • Login to the proot.

    $ proot-distro login <ALIAS>
  • Delete the proot.

    $ proot-distro remove <ALIAS>



Termux:X11 is an experimental app that provides a Xwayland display server to work in a Termux proot environment. This runs locally so a desktop environment or a single graphical application can be seen on the Android device.

Known issues:

  • Termux:X11 only works with Debian 11. It is confirmed to not work with newer Linux distributions such as Arch Linux and Ubuntu 22.04. [21]

  • Mouse events are not fully captured making gaming difficult. [22]

  • Wayland is not fully supported. Only legacy Xorg applications are fully supported.

  • Stability issues. This project is still very experimental.

Desktop Environment

Install and configure a Linux proot with a desktop environment. This can be accessed via the Termux:X11 once it is fully set up.

  • Download ande sideload the latest GitHub Actions build artifact that is from the “master” branch from here. It is required to be logged into GitHub to be able to download it.

  • Unzip the archive.

    $ unzip
      inflating: app-debug.apk
      inflating: output-metadata.json
      inflating: termux-x11-<VERSION>-all.deb
      inflating: termux-x11-<VERSION>-any.pkg.tar.xz
  • Install the app-debug.apk on the Android device.

  • In Termux, update all packages.

    (termux)$ pkg update
  • Install dependencies for Termux:X11. This includes launching a PulseAudio server when the Termux app starts for sound support.

    (termux)$ pkg install pulseaudio
    (termux)$ nano ~/.profile
    pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl= auth-anonymous=1" --exit-idle-time=-1
    pacmd load-module module-native-protocol-tcp auth-ip-acl= auth-anonymous=1
    (termux)$ pkg install x11-repo
    (termux)$ pkg install xwayland xorg-server-xvfb
  • Install the Debian package for Termux:X11 in Termux. This first requires giving Termux access to the Android file system.

    (termux)$ termux-setup-storage
    (termux)$ dpkg -i storage/shared/Download/termux-x11/termux-x11-<VERSION>-all.deb
  • Allow Termux:X11 to run commands within the Termux app.

    (termux)$ nano ~/.termux/
    allow-external-apps = yes
  • Force stop and then re-open the Termux app to load up the new properties that were just configured.

  • Open the Termux:X11 app and leave it open in the background.

  • Switch to the Termux app. Install and use either Arch Linux or Debian (recommended). A non-root user is required.

    • Arch Linux:

      (termux)$ proot-distro install archlinux
      (termux)$ proot-distro login archlinux
      (archlinux)$ pacman -Syyu
      (archlinux)$ nano /etc/locale.gen
      en_US.UTF-8 UTF-8
      (archlinux)$ echo 'LANG=en_US.UTF-8' > /etc/locale.conf
      (archlinux)$ locale-gen
      (archlinux)$ ln -s /usr/share/zoneinfo/<COUNTRY>/<CITY> /etc/localtime
      (archlinux)$ passwd root
      (archlinux)$ useradd -m -g users -G wheel,audio,video,storage -s /bin/bash <USER>
      (archlinux)$ passwd <USER>
      (archlinux)$ pacman -S sudo
      (archlinux)$ echo '<USER> ALL=(root) NOPASSWD:ALL' > /etc/sudoers.d/<USER>
      (archlinux)$ chmod 0440 /etc/sudoers.d/<USER>
      (archlinux)$ su - <USER>
      (archlinux)$ nano ~/.profile
      export PULSE_SERVER=
      pulseaudio --start --disable-shm=1 --exit-idle-time=-1
      (archlinux)$ sudo pacman -S firefox networkmanager pulseaudio xfce4 xfce4-goodies xorg xorg-server
      (archlinux)$ sudo pacman -S --needed base-devel git && git clone && cd yay && makepkg -si
    • Debian:

      (termux)$ proot-distro install debian
      (termux)$ proot-distro login debian
      (debian)$ apt-get update
      (debian)$ apt-get upgrade
      (debian)$ apt-get install locales
      (debian)$ nano /etc/locale.gen
      en_US.UTF-8 UTF-8
      (debian)$ echo 'LANG=en_US.UTF-8' > /etc/locale.conf
      (debian)$ locale-gen
      (debian)$ rm -f /etc/localtime
      (debian)$ ln -s /usr/share/zoneinfo/<COUNTRY>/<CITY> /etc/localtime
      (debian)$ passwd root
      (debian)$ groupadd storage
      (debian)$ groupadd wheel
      (debian)$ useradd -m -g users -G wheel,audio,video,storage -s /bin/bash <USER>
      (debian)$ passwd <USER>
      (debian)$ apt-get install sudo
      (debian)$ echo '<USER> ALL=(root) NOPASSWD:ALL' > /etc/sudoers.d/<USER>
      (debian)$ chmod 0440 /etc/sudoers.d/<USER>
      (debian)$ su - <USER>
      (debian)$ nano ~/.profile
      export PULSE_SERVER=
      pulseaudio --start --disable-shm=1 --exit-idle-time=-1
      (debian)$ sudo pacman -S firefox-esr network-manager pulseaudio xfce4 xfce4-goodies xorg xserver-xorg-core
  • Optionally configure and start a VNC server. This can only be accessed from a VNC viewer app on the Android device itself. VNC is also a slower desktop streaming protocol so gaming is not possible. Termux:X11 is recommended instead because it provides direct access to the display server.

    • Install a VNC server.

      • Arch Linux:

        (archlinux)$ sudo pacman -S tigervnc
      • Debian [28]:

      (debian)$ sudo apt-get install tigervnc-standalone-server tigervnc-common tightvncserver
    • Configure and start a VNC server.

      (archlinux)$ vncpasswd
      (archlinux)$ nano ~/.vnc/config
      (archlinux)$ nano ~/.vnc/xstartup
      export PULSE_SERVER=
      pulseaudio --start --disable-shm=1 --exit-idle-time=-1
      dbus-launch --exit-with-session xfce4-session
      (archlinux)$ vncserver :1
  • Start the display server in Termux (not the proot).

    (debian)$ exit
    (termux)$ XDG_RUNTIME_DIR="${TMPDIR}" termux-x11 :1 &
  • Enter the proot. The temporary directory must be shared to access information about the Xorg display server that Xwayland is emulating.

    (termux)$ proot-distro login --user <USER> --shared-tmp debian
  • Launch the XFCE desktop environment. [23]

    (debian)$ export DISPLAY=:1 XDG_RUNTIME_DIR="${TMPDIR}"
    (debian)$ dbus-launch --exit-with-session xfce4-session &


Graphics Hardware Acceleration
  • Install pre-built packages for virglrenderer and Mesa’s Zink. [31]

    (termux)$ pkg update
    (termux)$ pkg install virglrenderer
    (termux)$ pkg install tur-repo
    (termux)$ pkg install mesa-zink
  • Or manually compile virglrenderer and Mesa’s Zink. [32]

    • Install the build dependencies for virglrenderer.

      (termux)$ pkg update
      (termux)$ pkg upgrade
      (termux)$ pkg install x11-repo
      (termux)$ pkg update
      (termux)$ pkg install autoconf automake binutils bison clang cmake git glfw flex libandroid-shmem-static libdrm libjpeg-turbo libpciaccess libpixman libtool libx11 libxkbfile libxdamage libxfixes libxfont2 libxinerama libxxf86vm lld llvm make mesa-vulkan-icd-swrast ndk-sysroot ndk-multilib ninja python swiftshader vulkan-extension-layer vulkan-headers vulkan-loader vulkan-loader-generic vulkan-tools xcb-util-image xcb-util-keysyms xcb-util-renderutil xcb-util-wm xkeyoard-config xorg-xkbcomp xorg-font-util xorg-util-macros xorg-xrandr xorgproto xtrans
      (termux)$ pip install --user mako meson
      (termux)$ pkg install virglrenderer-android
    • Download and compile libxshmfence.

      (termux)$ cd ${TMPDIR}
      (termux)$ git clone --depth 1 -b libxshmfence-1.3.2
      (termux)$ cd libxshmfence
      (termux)$ ./ --prefix="${PREFIX}" --with-shared-memory-dir="${TMPDIR}"
      (termux)$ sed -i s/values.h/limits.h/ ./src/xshmfence_futex.h
      (termux)$ make -j $(nproc) install CPPFLAGS="-DMAXINT=INT_MAX"
    • Download and compile mesa.

      (termux)$ cd ${TMPDIR}
      (termux)$ git clone --depth 1 -b 22.3
      (termux)$ cd mesa
      (termux)$ sed -i '40s+^$+#include "X11/Xlib.h"+' src/egl/main/egldisplay.h
      (termux)$ sed -i 's/^import os$/import os, shutil\ndef link(src, dest):\n shutil.copyfile(src, dest)\ndef unlink(src):\n os.remove(src)\ = link\nos.unlink = unlink/' bin/
      (termux)$ mkdir build
      (termux)$ cd build
      (termux)$ LDFLAGS='-l:libandroid-shmem.a -llog' meson .. -Dprefix=$PREFIX -Dplatforms=x11 -Dgbm=enabled -Ddri-drivers='' -Dgallium-drivers=zink,swrast -Dllvm=disabled -Dvulkan-drivers='' -Dcpp_rtti=false -Dc_args=-Wno-error=incompatible-function-pointer-types -Dbuildtype=release
      (termux)$ rm $PREFIX/lib/*
      (termux)$ rm $PREFIX/lib/*
      (termux)$ rm $PREFIX/lib/libGLES*
      (termux)$ rm $PREFIX/lib/libEGL*
      (termux)$ rm $PREFIX/lib/libgbm*
      (termux)$ ninja install
    • Download and compile libepoxy.

      (termux)$ cd ${TMPDIR}
      (termux)$ git clone --depth 1 -b 1.5.10
      (termux)$ cd libepoxy
      (termux)$ mkdir build
      (termux)$ cd build
      (termux)$ meson -Dprefix=$PREFIX -Dbuildtype=release -Dglx=yes -Degl=yes -Dtests=false -Dc_args=-U__ANDROID__ ..
      (termux)$ rm $PREFIX/lib/*
      (termux)$ ninja install
    • Download and compile virglrenderer.

      (termux)$ cd ${TMPDIR}
      (termux)$ git clone
      (termux)$ cd virglrenderer
      (termux)$ git checkout fb441ecd0bdb0c9df253841b313e075238a64e2e
      (termux)$ sed -i 's+"/tmp+"/data/data/com.termux/files/usr/tmp+' vtest/vtest_protocol.h
      (termux)$ mkdir build
      (termux)$ cd build
      (termux)$ meson -Dbuildtype=release -Dprefix=$PREFIX -Dplatforms=egl ..
      (termux)$ ninja install
  • Start the virgl server for Android.

    (termux)$ MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.0 GALLIUM_DRIVER=zink virgl_test_server --use-egl-surfaceless &
  • Start the display server.

    (termux)$ XDG_RUNTIME_DIR="${TMPDIR}" termux-x11 :1 &
  • Enter the proot. The temporary directory must be shared to access information about the Xorg display server that Xwayland is emulating.

    (termux)$ proot-distro login --user <USER> --shared-tmp debian
  • Launch the XFCE desktop environment.

    (debian)$ export DISPLAY=:1 XDG_RUNTIME_DIR="${TMPDIR}"
    (debian)$ dbus-launch --exit-with-session xfce4-session &
  • Load demo OpenGL and Vulkan applications to make sure they work.

    (debian)$ sudo apt-get install mesa-utils
    (debian)$ glxgears
    (debian)$ sudo apt-get install vulkan-tools
    (debian)$ vkcube

Raspberry Pi

For the Raspberry Pi single-board computers, it is recommended to use custom LineageOS ROMs from They provide both a tablet ROM and an Android TV ROM. [15]



Error when starting Xwayland using Termux:X11.

(termux)$ DISPLAY=:0 termux-x11
Starting Xwayland
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)


  • If Xwayland is already running, either kill off the related processes or reboot the Android device. [29]

    (termux)$ killall xwayland
  • If Xwayland is not running, clean the temporary directory as it may contain various X11 lock files. [30]

    (termux)$ rm -rf ${TMPDIR}/*
    (termux)$ rm -rf ${TMPDIR}/.*
  • There used to be a known bug about a related issue. Update to the latest version of Termux:X11. [29]



  1. “How to install ADB on Windows, macOS, and Linux.” XDA Portal & Forums. March 25, 2023. Accessed April 10, 2023.

  2. “How To Install and Setup ADB Tools on Linux.” ByteXD. April 5, 2022. Accessed April 10, 2023.

  3. “Google apps.” LineageOS Wiki. April 9, 2023. Accessed April 10, 2023.

  4. “What are Google Apps (GApps)? Why do we need them?” RootMyGalaxy. September 5, 2020. Accessed April 10, 2023.

  5. “How to install the Google Play Store on any Android device.” Android Police. March 29, 2023. Accessed April 10, 2023.

  6. “Beginner’s guide to installing Lineage OS on your Android device.” Anroid Authority. March 9, 2023. Accessed April 11, 2023.

  7. “Install LineageOS on lemonadep.” LineageOS Wiki. April 11, 2023. Accessed April 11, 2023.

  8. “Hardware Support.” GitHub LineageOS/charter. April 10, 2023. Accessed April 11, 2023.

  9. “Google Lyra will enable voice calls for another billion users.” Tech Xplore. April 7, 2021. Accessed April 11, 2023.

  10. “Google Duo is Google Meet.” Google Workspace Admin Help. Accessed April 11, 2023.

  11. “Lyra V2 - a better, faster, and more versatile speech codec.” Google Open Source Blog. September 30, 2022. Accessed April 11, 2023.

  12. “Lyra, Satin and the future of voice codecs in WebRTC.” BlogGeek.Me. April 19, 2021. Accessed April 11, 2023.

  13. “Google Play Store Vs. Amazon App Store: The Clash of The App Store Players.” Mobile App Daily. March 14, 2023. Accessed April 11, 2023.

  14. “APKUpdater.” GitHub rumboalla/apkupdater. March 14, 2023. Accessed April 11, 2023.

  15. “Installing Android on Raspberry Pi 4 with Play Store.” RaspberryTips. August 14, 2022. Accessed April 11, 2023.

  16. “How to Install GCam on Non-Google Pixel Phones.” Geekflare Articles. November 22, 2022. Accessed April 12, 2023.

  17. “How To Install and Use GCam.” Google Camera Port. Accessed April 12, 2023.

  18. “PRoot.” Termux Wiki. Accessed April 13, 2023.

  19. “PRoot Distro.” GitHub termux/proot-distro. April 6, 2023. Accessed April 12, 2023.

  20. “Do not install Termux from Play Store!” Reddit r/termux. December 24, 2022. Accessed April 12, 2023.

  21. “Unable to get Termux:X11 working in a proot-distro #299.” GitHub termux/termux-x11. April 15, 2023. Accessed May 5, 2023.

  22. “Mouse capture #223.” GitHub termux/termux-x11. February 21, 2023. Accessed May 5, 2023.

  23. “xfce4-session stays just black #205.” GitHub termux/termux-x11. March 17, 2023. Accessed May 5, 2023.

  24. “How to install Arch Linux ARM on Android phone (Termux Proot-distro).” Ivon’s Blog. August 7, 2022. Accessed May 5, 2023.

  25. “How to use Termux X11 - The X server on Android phone.” Ivon’s Blog. March 8, 2023. Accessed May 5, 2023.

  26. “setting up termux-x11.” udroid wiki. April 22, 2023. Accessed May 5, 2023.

  27. “Graphical Environment.” Termux Wiki. Accessed May 5, 2023.

  28. “Install and Configure TigerVNC VNC Server on Debian 11/10.” ComputingForGeeks. February 16, 2023. Accessed May 5, 2023.

  29. “running termux-x11 fails #222.” GitHub termux/termux-x11. March 3, 2023. Accessed May 5, 2023.

  30. “unable to start termux x11 #151.” GitHub termux/termux-x11. February 5, 2023. Accessed May 5, 2023.

  31. “Hardware Acceleration in Proot?” Reddit r/termux. December 24, 2022. Accessed May 10, 2023.

  32. “virglrenderer: Termux GPU hardware acceleration tutorial.” Ivon’s Blog. March 13, 2023. Accessed May 10, 2023.