Kotlin setup.
Same AAR as Java, idiomatic Kotlin call sites. CameraX-ready in fifty lines.
| Android Gradle Plugin | 8.2 or later |
| minSdk | 24 (Android 7.0) |
| Kotlin | 2.0 or later |
| License token | JWT issued from /dashboard |
-
01
Download the AAR
Pull imaged.aar from the downloads page. Place it in app/libs/. arm64-v8a is the production target; x86_64 is included for emulators.
bashmkdir -p app/libs cp ~/Downloads/imaged.aar app/libs/ -
02
Wire up Gradle
Mirror the example app's build.gradle.kts: pull AARs from libs, keep ONNX files uncompressed, and use legacy JNI packaging so libsdk.so is extracted on install.
kotlin// app/build.gradle.kts android { namespace = "com.acme.detector" compileSdk = 36 defaultConfig { minSdk = 24 } androidResources { @Suppress("UnstableApiUsage") noCompress += "onnx" } packaging { jniLibs { useLegacyPackaging = true } } } dependencies { implementation(fileTree("libs") { include("*.aar") }) } -
03
Hello world
Initialize the loader once per process, construct ImagedSDK, set the license, verify it. ImagedLoader.load(context) also stages the Hexagon skel files so QNN HTP can engage on Snapdragon.
kotlinimport dev.imaged.sdk.ConfigurationOptions import dev.imaged.sdk.ImagedLoader import dev.imaged.sdk.ImagedSDK class Detector(context: android.content.Context) { private val ai: ImagedSDK init { ImagedLoader.load(context) ai = ImagedSDK() val cfg = ai.options cfg.setString("license.token", "your-license-token") cfg.setString("license.audience", "cameras.acme.com") val status = cfg.checkLicense() check(status == ConfigurationOptions.STATUS_SUCCESS && ai.isLicensed) { "license check failed, status $status" } android.util.Log.i("imaged", "version ${ai.version}") } } -
04
Run a family
Image implements AutoCloseable, so use { } closes the native handle for you. detect returns a ResponseObject; if response.error is non-zero, log message and skip the frame.
kotlinimport dev.imaged.sdk.ColorCode import dev.imaged.sdk.Image ai.options.setString("yolo.model", modelPath) ai.options.setString("yolo.inference.provider", "qnn") Image().use { img -> img.setData(rgbaBytes, width, height, ColorCode.RGBA) val response = ai.detect("yolo", img) response.objects.orEmpty().forEach { obj -> android.util.Log.i("imaged", "${obj.label} ${obj.score}") } } -
05
Where to go next
CameraDetector.kt in the Android example is the reference. It runs CameraX, feeds RGBA frames into the SDK on a single-thread executor, and posts results to a Compose overlay.