Skip to content

πŸ› Android release APK crashes with ViewNotFoundError while scanning (VisionCamera)Β #3696

@kavitha-digi

Description

@kavitha-digi

What's happening?

Crash occurs while setting or running a frameProcessor during scanning.
It throws ViewNotFoundError indicating that the Camera view ID cannot be found.

Reproduceable Code

const isFocused = useIsFocused();
const device = useCameraDevice('back');
const cameraRef = useRef(null);

const frameProcessor = useFrameProcessor(frame => {
  'worklet';
  // QR / frame processing logic
}, []);

if (!device) return null;

return (
  <Camera
    ref={cameraRef}
    style={StyleSheet.absoluteFill}
    device={device}
    isActive={isFocused}
    frameProcessor={frameProcessor}
  />
);

Relevant log output

Fatal Exception: java.lang.RuntimeException
Caused by java.lang.reflect.InvocationTargetException
Caused by com.mrousavy.camera.core.ViewNotFoundError
The given view (ID 10042) was not found in the view manager.
at com.mrousavy.camera.frameprocessors.VisionCameraProxy.findCameraViewById (VisionCameraProxy.kt:47)
at com.mrousavy.camera.frameprocessors.VisionCameraProxy.setFrameProcessor (VisionCameraProxy.kt:55)
at android.os.Handler.handleCallback (Handler.java:995)

Camera Device

{
   "formats":[],
   "hardwareLevel":"full",
   "hasFlash":true,
   "hasTorch":true,
   "id":"0",
   "isMultiCam":true,
   "maxExposure":20,
   "maxZoom":10,
   "minExposure":-20,
   "minFocusDistance":10,
   "minZoom":0.6000000238418579,
   "name":"0 (BACK) androidx.camera.camera2",
   "neutralZoom":1,
   "physicalDevices":[
      "wide-angle-camera",
      "ultra-wide-angle-camera",
      "wide-angle-camera",
      "telephoto-camera"
   ],
   "position":"back",
   "sensorOrientation":"landscape-left",
   "supportsFocus":true,
   "supportsLowLightBoost":false,
   "supportsRawCapture":false
}

Device

Samsung Galaxy Z Fold5 Android 16

VisionCamera Version

4.6.4

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions