ML Kit model installation paths on Android
Stay organized with collections
Save and categorize content based on your preferences.
Page Summary
-
ML Kit features utilize Google-trained machine learning models, offering three installation options: unbundled, bundled, and dynamically downloaded.
-
Unbundled models are downloaded via Google Play Services, while bundled models are included in the app, and dynamically downloaded models are fetched on demand.
-
Choosing between bundled and unbundled models depends on priorities: bundled for immediate functionality, unbundled for smaller app size and automatic updates.
-
Models can be downloaded at install time, explicitly requested, or downloaded on first use, and updates for bundled or dynamically downloaded models require app updates.
-
Dynamically downloaded models are offered for APIs with extensive model options, such as Digital Ink Recognition and Translation, to avoid bundling all possibilities.
All ML Kit features make use of Google-trained machine learning models (known as base models) by default. This guide is only applicable to base models. See here for guidance on custom models.
Models in ML Kit APIs can be installed in one of three ways:
- Unbundled: Models are downloaded and managed via Google Play Services.
- Bundled: Models are statically linked to your app at build time.
- Dynamically downloaded: Models are downloaded on demand.
Supported installation paths for each API
The table below shows which model installation paths are supported by each ML Kit feature:
API-specific guides show which installation options are available for the given API.
Key differences between installation options
How to choose between bundled and unbundled
If an API supports both the bundled and unbundled installation options:
Use the bundled option if you prioritize:
- Complete feature functionality immediately after app installation
- Feature functionality without network connection after app installation
Use the unbundled option if you prioritize:
- Smaller app size
- Automated model updates by Google Play Services
How to download models
When using the unbundled model option, you can specify how you want models to be downloaded to the device:
You can enable install-time model downloads by adding a declaration to your app's
AndroidManifest.xmlfile. For example, the code snippet below shows how to configure your app to automatically download the Barcode Scanning model after your app is installed from the Play Store:<application ...> ... <meta-data android:name="com.google.mlkit.vision.DEPENDENCIES" android:value="barcode" > <!-- To use multiple models: android:value="barcode,model2,model3" --> </application>You can request explicit download through Google Play Services ModuleInstallClient API.
If you don't enable install-time model downloads or request explicit download, the model will be downloaded the first time you run the feature. Until the download is completed, inference requests will fail.
How to update models
To update your models when using the bundled model or the dynamically downloaded models option:
Update your app's gradle file to use the latest ML Kit feature client library.
dependencies{ implementation'com.google.mlkit:barcode-scanning:17.3.0'// The latest version number of the API }Rebuild your app.
Why some APIs offer dynamically downloaded models
Some ML Kit API have too many model options to bundle. For example, Digital ink recognition supports 300+ languages, and it’s not always necessary to put every language inside the feature during installation. For that purpose, we provide the third installation option, in which models are downloaded on demand after installation. Currently, only Digital ink recognition, Translation and Entity extraction have this option.