Skip to content

Internal Exception when Scanning barcodes through CameraX API #95

@Davoleo

Description

@Davoleo

source code of my project: https://github.com/Davoleo/BarcodeStock

The exception I'm getting:

E/BarcodeStock: Barcode detection failed!
    com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
        at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@16.0.0:28)
        at com.google.mlkit.common.sdkinternal.zzn.call(Unknown Source:6)
        at com.google.mlkit.common.sdkinternal.zzm.run(com.google.mlkit:common@@16.0.0:5)
        at com.google.mlkit.common.sdkinternal.zzq.run(com.google.mlkit:common@@16.0.0:3)
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@16.0.0:24)
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(com.google.mlkit:common@@16.0.0:30)
        at com.google.mlkit.common.sdkinternal.zzj.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:784)
     Caused by: java.lang.IllegalArgumentException: Null image data supplied.
        at com.google.android.gms.vision.Frame$Builder.setImageData(com.google.android.gms:play-services-vision-common@@19.1.0:23)
        at com.google.mlkit.vision.barcode.internal.zzf.zza(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.1.0:75)
        at com.google.mlkit.vision.barcode.internal.zzf.zzb(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.1.0:83)
        at com.google.mlkit.vision.barcode.internal.zzf.run(com.google.android.gms:play-services-mlkit-barcode-scanning@@16.1.0:143)
        at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@16.0.0:23)
        at com.google.mlkit.vision.common.internal.zzb.call(Unknown Source:4)
        at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@16.0.0:26)
        at com.google.mlkit.common.sdkinternal.zzn.call(Unknown Source:6) 
        at com.google.mlkit.common.sdkinternal.zzm.run(com.google.mlkit:common@@16.0.0:5) 
        at com.google.mlkit.common.sdkinternal.zzq.run(com.google.mlkit:common@@16.0.0:3) 
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@16.0.0:24) 
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(com.google.mlkit:common@@16.0.0:30) 
        at com.google.mlkit.common.sdkinternal.zzj.run(Unknown Source:2) 
        at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:784) 

this line is spammed repeatedly as well:

I/GRALLOC: LockFlexLayout: baseFormat: 11, yStride: 640, ySize: 307200, uOffset: 307200,  uStride: 640

The analyzer calls the onFailure callback function and logs this exception which is first thrown in the com.google.android.gms.vision.Frame class although I didn't manage to understand which part of my code is behaving wrong because most of the classes are decompiled and have obfuscated variable names (var2, var5, zza)
image

this is the main class that controls the Camera and the analysis process
https://github.com/Davoleo/BarcodeStock/blob/master/app/src/main/java/io/github/davoleo/barcodestock/scanner/BarcodeScannerActivity.kt

What I'm asking here is if anyone that has encountered this issue or that is familiar with mlkit's source code could give me any pointers about fixing this kind of issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions