litert-runtime
Skill by android
Guides developers through building Android apps in Kotlin that run .tflite models with the LiteRT CompiledModel API on CPU and GPU. Intended for Android developers adding on-device inference, migration, or latency work.
Install litert-runtime
Built from the published package, never by AI.
git clone --depth 1 https://github.com/android/skills /tmp/skills && mkdir -p ~/.claude/skills && cp -r /tmp/skills/device-ai/litert/litert-runtime ~/.claude/skills/litert-runtimeRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/android/skills /tmp/skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/skills/device-ai/litert/litert-runtime ~/.gemini/antigravity-cli/skills/litert-runtimeAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides an AI assistant through building an Android app that runs a .tflite model with the LiteRT CompiledModel API in Kotlin. It covers Gradle setup for the Google Play services runtime or the bundled runtime, and an inference helper class. The helper runs on a single-thread dispatcher, reuses TensorBuffer instances, and performs a warm-up inference. It also covers GPU with CPU fallback, memory options, and migration from the legacy org.tensorflow.lite Interpreter.
It is for Android developers adding on-device image, vision, audio, or embedding inference. The skill points open text language models that use .litertlm files to the litert-lm skill, and it does not cover Python model conversion. It also helps fix apps whose results differ from Python, freeze during inference, or reload the model on rotation.
Written from the project's SKILL.md and checked against it.
What it can do
- Gradle setupConfigures the Google Play services runtime or the bundled LiteRT runtime in an Android project.
- Inference helper classBuilds an AutoCloseable class that owns a CompiledModel and its TensorBuffer instances.
- TensorBuffer reuseAllocates input and output buffers once and reuses them across inferences.
- GPU to CPU fallbackShows how to fall back from GPU to CPU with a warm-up on a single-thread dispatcher.
- Migration from legacy TFLiteExplains how to move code from org.tensorflow.lite Interpreter and GpuDelegate to CompiledModel.
- Latency benchmarkingCovers measuring model.run together with output buffer readback.
What you need
- A Kotlin Android project with minSdk 24 or higher
- Google Play services or the bundled LiteRT runtime
- A verified .tflite model and its input contract
Try asking
- Set up LiteRT with the Play services runtime in my Android app
- Write a Kotlin classifier helper that reuses TensorBuffer instances
- Migrate my org.tensorflow.lite Interpreter code to CompiledModel
Good to know
- Does not cover text LLMs that use .litertlm files.
- Does not cover Python model conversion.
- With the bundled litert artifact alone, GPU creation throws unless litert-gpu is also added.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: device-ai/litert/litert-runtime/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md27 KB -
references/android/google/play/on-device-ai.md37 KB -
references/migration.md19 KB -
references/play-services.md11 KB -
references/verify.md3 KB
Alternatives to litert-runtime
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
litert-runtime: common questions
Does this skill support Android LiteRT with GPU acceleration?
Yes. It explains how to compile a model for the GPU with Accelerator.GPU and how to add a CPU fallback. The source notes that the GPU accelerator needs the litert-gpu artifact in the bundled runtime.
Can I use this skill to migrate from TensorFlow Lite Interpreter?
Yes. The skill includes a migration section for org.tensorflow.lite Interpreter, GpuDelegate, and play-services-tflite code. It says migrated code must not import any org.tensorflow.lite class.
Is this skill for running LLMs on Android?
No. The source says text LLMs using .litertlm files are out of scope and points to the litert-lm skill instead.
How do I install litert-runtime?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is litert-runtime free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is litert-runtime safe to use?
It scores 93 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to litert-runtime?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
