Skip to content

LiteRT On-Device Inference for Android

Guides an agent to build Kotlin Android apps that run .tflite models on CPU/GPU with LiteRT.

Repository
android/skills
Stars
10,278
Licence
Apache-2.0
Files
5 files

What it does

When installed, the agent follows a detailed playbook for adding on-device machine learning inference to an Android app using Google's LiteRT runtime and its CompiledModel API. It helps choose between the Google Play services runtime and the bundled runtime, set up Gradle, place or deliver .tflite model files, manage threads and buffers safely, add GPU-to-CPU fallback, migrate from the legacy TensorFlow Lite Interpreter, and benchmark latency. The skill is a set of written instructions and reference documents; it does not itself run a model.

Great for

  • Android developers adding image classification, vision, audio or embedding models to a Kotlin app
  • Teams migrating an app from org.tensorflow.lite Interpreter or GpuDelegate to LiteRT
  • Developers who want guidance on Play for On-Device AI packs and Play services delivery of LiteRT

Skip it if

  • Running generative text LLMs with .litertlm files (the skill says to use the separate litert-lm skill instead)
  • Converting models in Python; the skill explicitly excludes model conversion
  • Non-Android or non-Kotlin projects, where the guidance does not apply

Try asking

  • “Add LiteRT image classification to my Kotlin Android app with GPU acceleration and CPU fallback”
  • “Migrate my app from org.tensorflow.lite.Interpreter to the LiteRT CompiledModel API”
  • “Set up play-services-litert in my Gradle build and load a .tflite model from assets”
  • “Benchmark the latency of my on-device model's model.run and output readback on Android”
Step-by-step guide: how to use LiteRT On-Device Inference for AndroidInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 5 original files, the Apache-2.0 licence and an attribution note.

    litert-runtime.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip litert-runtime.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip litert-runtime.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Have the agent read the referenced play-services.md file before editing build files, since the skill requires it
  • Give the agent your model's input contract (dimensions, mean, standard deviation, channel order) so preprocessing is correct
  • Ask the agent to run ./gradlew assembleDebug after dependency changes to confirm the build still works

What's inside

  • references/android/google/play/on-device-ai.md
  • references/migration.md
  • references/play-services.md
  • references/verify.md
  • SKILL.md

Redistributed unmodified from android/skills under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.