Google ML Kit Dependency
Anyline’s scanning runs on the Anyline scanning engine and does not use Google ML Kit. Two optional features are the exception, and both are off by default.
This page applies to Android only. On iOS, both features come from the operating system, so there is nothing to add.
|
As of Anyline Mobile SDK 56.3.0, the Anyline Android SDK no longer bundles Google ML Kit, and the Infinity Plugin no longer receives it transitively. If your app uses one of the two features below, add the matching dependency to your Android host app yourself. Enabling a feature without its module does not disable the feature silently. The scan view fails to initialize. See If the dependency is missing. |
Do you need Google ML Kit?
Both features are disabled by default, so most integrations need nothing.
| Feature | Needs ML Kit on Android | Dependency to add |
|---|---|---|
Anyline barcode scanning (Barcode plugin) |
No |
None (runs on the Anyline engine) |
OCR, Meter, ID / MRZ, License Plate, Tire, VIN, Container, Document |
No |
None ( |
Face detection on Universal ID / MRZ ( |
Yes |
|
Native barcode detection (the |
Yes |
|
Native barcode detection is an optional, legacy camera-feed detector. Anyline’s own barcode scanning does not use it.
Search your ScanViewConfig JSON files for faceDetectionEnabled and nativeBarcodeScanningFormats. If neither appears, your app needs no Google ML Kit.
|
Add Google ML Kit (only if you need it)
Add only the module for the feature you use. The file differs per framework, because two of the three generate the Android project.
-
Cordova
The Anyline Cordova plugin does not declare Google ML Kit, so the dependency has to come from your app. platforms/android/ is generated by cordova platform add, so put the declaration in a tracked file and have config.xml copy it in.
Create build-extras.gradle next to your config.xml:
dependencies {
// Add only the module(s) for the features you use:
implementation 'com.google.mlkit:face-detection:16.1.7' // for faceDetectionEnabled
implementation 'com.google.mlkit:barcode-scanning:17.3.0' // for nativeBarcodeScanningFormats
}
Then reference it from the Android platform section of config.xml:
<platform name="android">
<resource-file src="build-extras.gradle" target="app/build-extras.gradle" />
</platform>
cordova prepare copies the file to platforms/android/app/build-extras.gradle, which cordova-android applies automatically. Because the source file is tracked and the copy is driven by config.xml, this survives a clean checkout followed by cordova platform add.
Editing platforms/android/app/build-extras.gradle directly also works, but that file is generated and is lost whenever the Android platform is removed and re-added.
|
Once the module is present, no further setup is required. The Anyline SDK initializes ML Kit on demand when the feature runs.
iOS
Nothing to add. On iOS, face detection and native barcode detection use frameworks that ship with the operating system, so both features work with no extra dependency and no change to your Podfile.
This has one consequence worth knowing. The same ScanViewConfig can behave differently across platforms: if you forget the Android dependency, the feature works on iOS and fails to start on Android.
If the dependency is missing
A configuration that enables faceDetectionEnabled or nativeBarcodeScanningFormats, on an Android build without the matching module, fails fast. The Anyline Android SDK validates the configuration while reading it, before the camera opens and before any scanning starts, then raises an error naming the missing module.
The failure reaches your code through the plugin’s normal error path, the same one described in Error Handling. The scan start request does not succeed, and the error text names the missing Google ML Kit module and how to resolve it.
Because the check happens at configuration-read time, the failure is deterministic and reproduces on every scan start. To resolve it, either add the dependency for that feature or turn the feature off in your ScanViewConfig.
Google’s data collection
Google ML Kit is Google’s software, not Anyline’s. When you add it to your app, it runs under Google’s ML Kit terms and may send its own diagnostic and usage data to Google. That traffic comes from the ML Kit libraries running in your app. It does not pass through the Anyline SDK, and Anyline neither controls it nor receives any of it.
Accepting Google’s terms is therefore a matter between your app and Google. If your app carries privacy notice, consent or data processing obligations, Google ML Kit falls under your app’s, not Anyline’s.
If you do not add it, no Google ML Kit code ships in your app and none of this applies. The next section shows how to confirm that.
Verify a build without Google ML Kit
For privacy-sensitive deployments that use neither feature, confirm no ML Kit reaches the APK:
-
Check the APK with the Android Studio APK Analyzer. There should be no
com.google.mlkit.*classes. -
Inspect the merged manifest (
app/build/intermediates/merged_manifest/…/AndroidManifest.xml). There should be nocom.google.mlkit.common.internal.MlKitInitProvider. -
Run your scan and confirm it completes with no crash and no Google ML Kit or Google Play Services network traffic.
Other dependencies in your app may pull in Google ML Kit independently of Anyline.
Next Steps
-
Getting Started with Infinity Plugins (install and initialize the plugin)
-
Advanced Topics (UI configuration, native view integration, error handling)