Build an Android Llama chat app with ExecuTorch and XNNPACK
Introduction
Create a development environment
ExecuTorch Setup
Understanding Llama models
Prepare Llama models for ExecuTorch
Run Benchmark on Android phone
Build and Run Android chat app
Next Steps
Build an Android Llama chat app with ExecuTorch and XNNPACK
Review frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
Use an isolated environment. You can choose either a Python virtual environment or a Conda environment. You need only one environment.
Request access on Meta’s Llama Downloads page and use the time-limited download link you receive. Install the
llama-stack package from pip, then run the provided command to download the model using your download link.Set the
ANDROID_NDK environment variable to your NDK path. Confirm that $ANDROID_NDK/build/cmake/android.toolchain.cmake exists so CMake can locate the Android toolchain.You’ll build the ExecuTorch runtime and a Llama runner binary for Android, along with JNI libraries for the app. Use these artifacts to run the model and execute benchmarks on the Android device.
Yes. The same instructions apply to other Llama options with minimal modification.