Chat application for Android on Snapdragon® with Llama 3.2 3B using Genie SDK.
This app showcases the use of Genie C++ APIs from QNN SDK to run and accelerate LLMs using the Snapdragon® Neural Processing Unit (NPU).
🎙️ The app also supports loading of Whisper for voice input.
ChatApp V2 does not work on all consumer devices with Android 14.
Genie SDK requires a newer meta-build to run LLMs on-device. Functionality may vary depending on your phone vendor's meta-build selection.
Device | OS |
---|---|
Samsung Galaxy S25 Ultra | One UI 6.1 (Android 15) |
LLM
Model | Context length |
---|---|
Llama 3.2 3B | 2048 |
Whisper
Model |
---|
Whisper Tiny |
💡 If you have a listed device, update to the specified OS version or newer to run the Sample App locally.
- Snapdragon® Gen 3 or Snapdragon® 8 Elite
- QNN SDK version 2.31.0 or newer
- Compiled QNN context binaries for the above QNN SDK version
local.properties
file with validsdk.dir
property in root directory:sdk.dir=<path to android sdk>
- Download
.apk
- Push
.apk
to device:adb push ChatApp.apk /data/local/tmp
- Open ADB Shell on android device:
Then install
adb shell
ChatApp.apk
:pm install -r /data/local/tmp/ChatApp.apk
- 🔧
/opt/qcom/aistack/qairt/2.31.0
: Example QNN-SDK location - 📚
/opt/qcom/aitstack/qairt/2.31.0/lib/external
: WhisperKit Android.so
files - 📋
app/src/main/assets/config/models.json
: List of available models - 🗂️
app/src/main/assets/
: Whisper models location - 📊
app/src/main/assets/models
: LLM models location - ⚙️
app/src/main/assets/htp_config
: HTP config files location
-
Clone repository:
git clone https://github.com/argmaxinc/WhisperKitAndroid.git cd WhisperKitAndroid
-
Update
jni/NativeWhisperKit.cpp
function names to match this projectJava_com_edgeai_chatappv2_WhisperKitNative_<function_name>
-
Update
Whipserkit/src/TranscribeTask.cpp
to support the correctlib
,cache
andfiles
path when building forjni
.#if (JNI_BUILD) #define TRANSCRIBE_TASK_TFLITE_ROOT_PATH "/data/user/0/com.edgeai.chatappv2/files" #define TRANSCRIBE_TASK_DEFAULT_LIB_DIR "/data/user/0/com.edgeai.chatappv2/lib" #define TRANSCRIBE_TASK_DEFAULT_CACHE_DIR "/data/user/0/com.edgeai.chatappv2/cache" #elif (QNN_DELEGATE || GPU_DELEGATE) ...
-
Update versions in
scripts/dev_env.sh
andscripts/Dockerfile
with correct QNN SDK version e.g.2.31.0
- Example
scripts/dev_env.sh
aria2c $ARIA_OPTIONS -d $BUILD_DIR https://repo1.maven.org/maven2/com/qualcomm/qti/qnn-runtime/2.31.0/qnn-runtime-2.31.0.aar aria2c $ARIA_OPTIONS -d $BUILD_DIR https://repo1.maven.org/maven2/com/qualcomm/qti/qnn-litert-delegate/2.31.0/qnn-litert-delegate-2.31.0.aar
- Example
scripts/Dockerfile
ARG QNN_RUNTIME=qnn-runtime-2.31.0.aar ARG QNN_TFLITE_DELEGATE=qnn-litert-delegate-2.31.0.aar
- Example
-
Build dev environment
make env
-
Build
.so
files inside of dev environment:make build jni
-
Copy
.so
files to/opt/qcom/aitstack/qairt/2.31.0/lib/external
, files to transfer:From
external/libs/android/
:libavcodec.so
libavformat.so
libavutil.so
libqnn_delegate_jni.so
libSDL3.so
libswresample.so
libtensorflowlite.so
libtensorflowlite_gpu_delegate.so
From
build/android/
:libwhisperkit.so
libnative-whisperkit.so
This repository is built on-top of:
This app is released under the AGPL-3.0 License.