Reputation: 1
I am trying to access a bitmap saved file and perform ObjectDetection on it. I utilize ImageFactory for this, but creating a new instance fails.
val imageFactory1 = ImageFactory.getInstance()
Caused by: java.lang.IllegalStateException: Create new ImageFactory failed! Caused by: java.lang.ClassNotFoundException: ai.djl.android.core.BitmapImageFactory Caused by: java.lang.ClassNotFoundException: Didn't find class "ai.djl.android.core.BitmapImageFactory" on path: DexPathList[[zip file "/data/app/com.example.imageclassification2-_snYrn7mbGjXlperEzCKWg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.imageclassification2-_snYrn7mbGjXlperEzCKWg==/lib/arm64, /data/app/com.example.imageclassification2-_snYrn7mbGjXlperEzCKWg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
Not sure what BitmapImageFactory is, I've never heard about it.
Upvotes: 0
Views: 60
Reputation: 1
The class ImageFactory can not be found, it looks like you are using the the DLJ library, make sure you have proper dependencies
dependencies {
implementation platform("ai.djl:bom:0.20.0")
implementation "ai.djl:api"
// TODO: remove djl android package version in 0.21.0
implementation "ai.djl.android:core:0.20.0"
runtimeOnly "ai.djl.pytorch:pytorch-engine"
runtimeOnly "ai.djl.android:pytorch-native:0.20.0"
runtimeOnly "ai.djl.android:onnxruntime:0.20.0"
}
Upvotes: 0