Skip to content
android-4-linuxPublic

About

Run unmodified Android apps on Linux with no emulator and no Android image. APKs and their NDK libraries run on real ART as native Wayland clients: Compose, Views, Flutter, WebView, Unity and SDL2 games, audio, video and calls. Clean-room C++23, Apache-2.0. x86-64 and arm64, from a desktop to a Raspberry Pi, a kiosk or an IVI head unit.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

9 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,388 Commits

Folders and files

a4l

ci License: Apache-2.0 REUSE 3.3

Android apps on Linux, without an emulator and without an Android device image.

a4l runs the app, not the OS. An unmodified APK's DEX executes on real ART in one glibc process, next to a4l's native core and the app's own NDK libraries. The app is an xdg-toplevel (or an ivi-shell surface) on the compositor the product already runs. There is no second compositor, no binder, no device image and no VM boundary. The Java framework is a vendored Apache-2.0 AOSP subset. a4l is clean-room C++23 and Apache-2.0; it shares no source with the GPL-3.0 project that came before it.

It is meant for a Linux product that needs an Android app it does not own: an IVI head unit, a kiosk, a panel, a workstation. It runs on x86-64 and arm64.

What runs

Seen on screen on an x86-64 desktop and on Raspberry Pi 4 and 5 boards, as of 2026-12-01. The corpus row is a headless count from the same day.

App What works
Sonos Sign-in and everything tried
Pandora Everything tried
Spotify Works, and so does its Android Automotive build
WhatsApp Sign-in, chat, audio calls
Telegram Sign-in, chat, audio, embedded YouTube video
Microsoft Teams Calls
Waze Works
Zwift Signs in and runs
Trailforks Sign-in, the map with a location, activities and stats
SuperTuxKart 1.5 Tutorial race, steered by touch
Gems of War Runs to its age check, which needs the Play Store
F-Droid corpus (18 apps) 17 reach layout

Sign-in by QR code or by email works. Sign-in through Google or Facebook has not been tested.

By toolkit:

  • Compose and Views draw through Skia (Ganesh Vulkan) into a dma-buf, with no copy.
  • Flutter runs on an unmodified engine. libflutter.so loads against a4l's libandroid.so and its EGL/GLES calls forward to host Mesa. A Flutter app with Rive animations works (Sonos).
  • WebView composites through Chromium's Vulkan functor.
  • Video in a SurfaceView goes to a wl_subsurface under the toplevel, as on Android.
  • Native GL (GLSurfaceView, SDL2, Unity, libGDX) renders with Mesa straight to a4l's wl_surface.

Not there yet: Google Play services and the Play Store, more than one app at a time with Binder between them, and confinement of an app's native code. An app that checks its own integrity will usually refuse to start. docs/app-corpus-status.md has the F-Droid corpus app by app, and SECURITY.md says what a4l does and does not check about an APK.

Quick start

a4l needs a host ART build from an AOSP tree at the tag in third_party/aosp/METADATA:

source build/envsetup.sh && lunch aosp_x86_64-eng && m dalvikvm dex2oat libart

With that and a Wayland session:

meson setup build && meson compile -C build
export ACL_ART_HOME=<aosp>/out/host/linux-x86
ACL_PRESENT_GPU=1 ACL_RUN_TIMEOUT=0 tools/run-apk.sh app.apk --present

ACL_PRESENT_GPU=1 selects the zero-copy path that real apps need. Without it a4l uses wl_shm, and a first run usually looks empty. tools/run-apk.sh builds the framework jars on first use and stops the app after 60 seconds unless ACL_RUN_TIMEOUT=0.

On arm64 AOSP has no glibc host ART. The patch set in tools/aosp/glibc-arm64 builds one, and the Raspberry Pi rows above run on it. docs/split-process-art.md describes the older path that keeps ART in its own bionic process.

One process, and three paths that never copy a frame

a4l layer stack: APK, ART, AOSP framework and a4l core in one glibc process

Figure 1 draws the boundary the rest of the design follows. Everything inside the dashed enclosure is one glibc process, on x86-64 and on arm64; everything below it is the stack the product already ships, unchanged. No Android compositor, no binder and no second graphics driver appear in the drawing because none of them is in the process. On arm64 that takes the glibc host ART from tools/aosp/glibc-arm64. With only the stock bionic host ART, ART runs in a second process (docs/split-process-art.md), as the note on the sheet says. The accent marks what sits on a zero-copy path.

a4l present paths: GPU, native GL, video, and the wl_shm fallback

Figure 2 follows one frame from the app to the display controller on each of the four present paths. The first three reach the compositor with no CPU copy, and on the native-GL path a4l allocates no buffer at all -- Mesa renders and commits a4l's own wl_surface inside eglSwapBuffers. The fourth is the default, and it is the usual reason a first run without ACL_PRESENT_GPU=1 looks empty.

Questions and reports

Ask in Discussions. To report how an app runs, working or not, use the app report form.

Read these first

  • plan.md — full design, ADRs, phases, risk register (source of truth).
  • PROVENANCE.md — enforced source/license policy. The overriding rule: never open the GPL-3.0 predecessor's tree; take the Android API surface from Apache-2.0 AOSP (AOSP-down, not GPL-across).
  • docs/clean-room.md — the clean-room protocol and current posture.
  • docs/adr/ — architecture decision records.
  • docs/README.md — an index of everything else under docs/.
  • CONTRIBUTING.md — SPDX + provenance + DCO requirements.

Build

Build system is Meson (native to the Wayland/PipeWire/Mesa stack this integrates against). Heavy vendored deps keep their own builds — Skia via GN, AOSP ART/frameworks via Soong — and are consumed as prebuilt imported artifacts. The unit tests need none of them.

meson setup build
meson compile -C build
./build/src/shell/a4l           # prints version + linked module roster

meson test -C build                # Tier A unit tests (needs: meson wrap install catch2)

Automotive profile is ON by default. Build the phone subset (must emit zero automotive symbols) or cross-compile for a board:

meson setup build-phone -Dprofile_automotive=false
meson setup build-rk3588 --cross-file cross/rk3588.ini

Packaging

Each optional part has a Meson feature option of its name: wayland, skia, vulkan, gl, dmabuf_codec, gstreamer, ffmpeg, drm_cxx, alsa, pipewire, libcamera, sdbus, secret, crypto. The default, auto, builds a part when its dependencies are found; enabled makes a missing dependency a configure error, and disabled leaves the part out whatever is installed. meson configure build lists them.

jni.h is required. It comes from the JDK whose java is on PATH, and a4l records that JDK's javac and libjvm.so paths for --vm=jvm. A build with no JDK, or one whose build machine is not where a4l will run, gives the headers and the paths itself, and can turn off the search for an AOSP checkout's android.jar:

meson setup build --buildtype=plain \
    -Djni_include=/path/to/jni-headers -Dlibjvm=libjvm.so -Dandroid_jar=none \
    -Dskia=enabled -Dskia_prefix=/path/to/skia -Dvulkan=enabled -Dwayland=enabled

meson install --skip-subprojects installs a4l alone: bin/a4l, and with FFmpeg <libdir>/a4l/libsoundpool.so, which a4l opens from there itself. Without the flag a subproject built from a wrap installs its own files too (wayland-cxx-scanner's headers).

On an ivi-shell compositor

An ivi-shell compositor (Weston's ivi-shell.so with a layer-manager controller) shows a surface only when it has an ivi id that the controller puts on a layer. Give a4l the id:

a4l run app.apk --present --ivi-surface-id=9000

a4l then takes its window role from ivi_application and not xdg_wm_base, and takes the size the controller sends as it takes a toplevel's. ACL_WL_SHELL=ivi with ACL_IVI_SURFACE_ID does the same. There is no id to ask the compositor for: pick one the platform has set aside. Run 2026-11-16 on Weston 15 with a test controller, View and GL apps, single-process and --split, and the wl_shm presenter on Weston 8 on an SA8155P board; wm-ivi-shell is the test. Not done: ivi_wm (a4l does not place or raise its own surface), and input was not tried.

Layout

src/{runtime,pkg,wm,gfx,input,audio,media,svc,ndk,shell}   native core (C++23)
src/svc/car/                                                vehicle property hub (automotive)
hosts/{cal,media}                                           Car App Library + media bridges (automotive)
third_party/{aosp,skia}                                     vendored, pinned, prebuilt-consumed
specs/                                                      sanitized functional specs (clean-room)
tests/{unit,integration,cts-runner,app-corpus}             Tier A/B + CTS oracle + real-app corpus
docs/adr/                                                   architecture decision records
scripts/, .github/workflows/                                CI license/provenance/SPDX gates (Gate G0)

License

Apache-2.0. Copyright 2026 Contributors to a4l, stated in NOTICE.

LICENSE holds the license text verbatim, because automated license detection matches that file by content rather than by what it claims; LICENSES/ holds the same text under its SPDX identifier, where the REUSE specification looks for it. Every file in the tree declares its own license with an SPDX tag, REUSE.toml records the copyright holder for files that cannot carry a header, and reuse lint verifies that nothing is unaccounted for.

About

Run unmodified Android apps on Linux with no emulator and no Android image. APKs and their NDK libraries run on real ART as native Wayland clients: Compose, Views, Flutter, WebView, Unity and SDL2 games, audio, video and calls. Clean-room C++23, Apache-2.0. x86-64 and arm64, from a desktop to a Raspberry Pi, a kiosk or an IVI head unit.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages