Run your ML models on Android with hardware acceleration, without shipping the
LiteRT runtime in your APK. LiteRT in Google Play services gives you:

- **Smaller apps (up to \~8 MB)**: Remove bundled runtime and GPU binaries from your APK by sharing a single runtime across apps through Google Play services.
- **Faster GPU inference**: Run models up to 1.4x faster on GPU than with the previous TensorFlow Lite GPU delegate, powered by LiteRT's ML Drift GPU accelerator.
- **Production-ready and auto-updated**: Hardened releases, performance improvements, and fixes arrive in phases through Google Play services updates across billions of Android devices, without an app release.
- **Frictionless migration, same API** : Run models on CPU or GPU with the same `CompiledModel` API as standalone LiteRT. Only your dependency and how you create the `Environment` change. Continued `Interpreter` API support on CPU lets you switch your dependency first and migrate at your own pace. NPU acceleration is [coming soon](https://developers.google.com/edge/litert/android/play_services#coming-soon).

| If your app... | Then |
|---|---|
| Uses the `Interpreter` API in Google Play services (`play-services-tflite-java`) | Switch your dependency to `play-services-litert`. Your `Interpreter` code keeps running on CPU. Then move to the `CompiledModel` API to add GPU acceleration. See [Upgrade to the LiteRT v2 API](https://developers.google.com/edge/litert/migration#upgrade-to-v2). |
| Bundles standalone LiteRT 2.x or TensorFlow Lite (`com.google.ai.edge.litert:litert`, `org.tensorflow:tensorflow-lite`) | Switch to Google Play services to remove the runtime from your APK. See [Migrating from standalone LiteRT](https://developers.google.com/edge/litert/android/compiled_model_java#migrating). |
| Needs NPU acceleration or custom ops today, or must run on devices without Google Play services | Use [standalone LiteRT](https://developers.google.com/edge/litert/android). |

## Choose an API

`play-services-litert` includes both APIs, so you can update your dependency
first and move to the `CompiledModel` API at your own pace.

| API | Kotlin and Java | C++ | Maven package |
|---|---|---|---|
| **`CompiledModel`** (recommended) | [Guide](https://developers.google.com/edge/litert/android/compiled_model_java) | [Guide](https://developers.google.com/edge/litert/android/compiled_model_cpp) | `com.google.android.gms:play-services-litert` |
| **`Interpreter`** (older API) | [Guide](https://developers.google.com/edge/litert/android/java) | [Guide](https://developers.google.com/edge/litert/android/native) | `com.google.android.gms:play-services-litert` (CPU only), or `com.google.android.gms:play-services-tflite-java` (16.x) |

- New features are added to the `CompiledModel` API.
- LiteRT 1.x SDKs (Google Play services 16.x, `play-services-tflite-*`) receive only critical security fixes. Apps built with them keep working on the Google Play services runtime.
- Use either `play-services-litert` or `play-services-tflite-java`, not both.

> [!NOTE]
> **Terms:** By accessing or using LiteRT in Google Play services APIs, you agree to the [Terms of Service](https://developers.google.com/edge/litert/android/play_services#tos). Please read and understand all applicable terms and policies before accessing the APIs.

## Get started

> [!TIP]
> **Tip:** Let your coding agent do the conversion. Add the [LiteRT runtime skill](https://github.com/android/skills/tree/main/device-ai/litert/litert-runtime) with `android skills add litert-runtime`, or type `@litert-runtime` in Android Studio Agent Mode, then ask it to migrate your app to LiteRT in Google Play services.

| Step | Kotlin and Java | C++ |
|---|---|---|
| 1. Add the dependency | [Add dependencies](https://developers.google.com/edge/litert/android/compiled_model_java#dependencies) | [Build configuration](https://developers.google.com/edge/litert/android/compiled_model_cpp#build-config) |
| 2. Initialize | [Initialize](https://developers.google.com/edge/litert/android/compiled_model_java#initialize) | [Native handle](https://developers.google.com/edge/litert/android/compiled_model_cpp#initialize) |
| 3. Run on CPU | [Run inference](https://developers.google.com/edge/litert/android/compiled_model_java#cpu-inference) | [Run inference](https://developers.google.com/edge/litert/android/compiled_model_cpp#cpu-inference) |
| 4. Turn on GPU | [GPU acceleration](https://developers.google.com/edge/litert/android/compiled_model_java#gpu) | [GPU acceleration](https://developers.google.com/edge/litert/android/compiled_model_cpp#gpu) |

## Coming soon

- **NPU acceleration in Google Play services** : NPU acceleration is available today in [standalone LiteRT](https://developers.google.com/edge/litert/next/npu).

## Support and feedback

Report issues and feature requests on the
[LiteRT GitHub issue tracker](https://github.com/google-ai-edge/LiteRT/issues).
Include "Google Play services" in the issue title so it reaches the right team.
For more about Google Play services, see the
[Google Play services](https://developers.google.com/android/guides/overview)
website.

## Terms of service

Use of LiteRT in Google Play services APIs is subject to the
[Google APIs Terms of Service](https://developers.google.com/terms/).

### Privacy and data collection

When you use LiteRT in Google Play services APIs, processing of the
input data, such as images, video, text, fully happens on-device, and LiteRT in
Google Play services APIs do not send that data to Google servers. As
a result, you can use our APIs for processing data that should not leave the
device.

The LiteRT in Google Play services APIs may contact Google servers from
time to time in order to receive things like bug fixes, updated models and
hardware accelerator compatibility information. The LiteRT in Google
Play services APIs also sends metrics about the performance and utilization of
the APIs in your app to Google. Google uses this metrics data to measure
performance, debug, maintain and improve the APIs, and detect misuse or abuse,
as further described in our
[Privacy Policy](https://policies.google.com/privacy).

**You are responsible for informing users of your app about Google's processing
of LiteRT in Google Play services APIs metrics data as required by
applicable law.**

Data we collect includes the following:

- Device information (such as manufacturer, model, OS version and build) and available ML hardware accelerators (GPU and NPU). Used for diagnostics and usage analytics.
- Device identifier used for diagnostics and usage analytics.
- App information (package name, app version). Used for diagnostics and usage analytics.
- API configuration (such as which accelerators or delegates are used). Used for diagnostics and usage analytics.
- Event type (such as model compilation, interpreter creation, and inference). Used for diagnostics and usage analytics.
- Error codes. Used for diagnostics.
- Performance metrics. Used for diagnostics.