Skip to content

alifthi/Android-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android-Assistant (llama_cli)

Minimal Android NDK build of a llama.cpp-based CLI that runs an interactive chat loop on-device. This repo builds a single native binary plus the NDK libc++_shared.so runtime.

Requirements

  • Android NDK installed (r21+ should work; uses LLVM toolchain)
  • adb for pushing/running on a device or emulator
  • A GGUF model file compatible with llama.cpp

Build

  1. Set the NDK path (one of these is required). Example:
export ANDROID_NDK_HOME=/path/to/android-ndk

You can also use ANDROID_NDK_ROOT or NDK_HOME instead of ANDROID_NDK_HOME.

  1. Optional build tuning (defaults shown):
export ANDROID_ABI=arm64-v8a
export ANDROID_API=21
  1. Build:
make

Outputs:

  • build/llama_cli
  • build/libc++_shared.so

Run (device/emulator)

  1. Push the binaries and model:
adb push build/llama_cli /data/local/tmp/
adb push build/libc++_shared.so /data/local/tmp/
adb push /path/to/model.gguf /data/local/tmp/model.gguf
  1. Run on device:
adb shell
cd /data/local/tmp
chmod 755 llama_cli
export LD_LIBRARY_PATH=/data/local/tmp
./llama_cli
  1. Type a prompt and press Enter. Type exit to quit.

Configuration Model path is currently fixed at compile time via include/config.h. The default is MODEL_PATH "/data/local/tmp/model.gguf".

You can also tune N_CTX, N_BATCH, N_THREADS, and N_GPU_LAYERS in include/config.h.

If you want -m /path/to/model.gguf to work at runtime, update native/llama_cli.cpp to pass the CLI argument into load_model(...) instead of MODEL_PATH.

About

A local assistant SDK for Android phone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors