Add image injection SDK to your Android app

Learn how to implement Kobiton’s custom SDK in your Android application to enable Image Injection.


  • Android 9 or newer.

  • An Android project with Gradle build tool.

  • The application uses camera2 library. See the full list of supported methods in camera2.

  • Download the Image Injection SDK file here. The downloaded file name should be: camera2.arr.

Integrate the SDK

Create a new folder named libs under <project_folder>/app, where <project_folder> is the root folder of the Android project to be altered. Copy the downloaded camera2.arr file into the newly created folder.

The camera2 file under the libs folder

Under <project_folder>/app, edit the build.gradle file and add the following line under dependencies to allow your application to use the .arr file:

implementation fileTree(dir: 'libs', include: ['*.aar'])

Under <project_folder>/app/src/main, edit the AndroidManifest.xml file and add the following lines within the application tag. This service is used to connect the SDK to Kobiton Server.

<service android:name="kobiton.hardware.camera2.ImageInjectionClient" />

The new service line in android manifest

Within the same AndroidManifest.xml file as above, add the following lines within the manifest tag to grant the 2 permissions INTERNET and ACCESS_NETWORK_STATE for the SDK to connect to Kobiton’s Server.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

The new uses permission line in android manifest

Replace all texts in the project according to the below table to replace the stock Android library with the custom Kobiton library:

Replace With











Update the CameraManager’s initial method by replacing Context.getSystemService(Context.CAMERA_SERVICE) with CameraManager.getInstance(context). For example, replace:

private val cameraManager: CameraManager by lazy {
        val context = requireContext().applicationContext
        context.getSystemService(Context.CAMERA_SERVICE) as CameraManager


private val cameraManager: CameraManager by lazy {

After all the above changes are made, package your app into an .apk, .aab or .zip file.

Upload the app package to the app repository or to the cloud and install the app on a Kobiton device, then follow the guides to use image injection in a manual session or an automation session.