CameraView icon indicating copy to clipboard operation
CameraView copied to clipboard

PictureResult.getData() returns null on some devices after onPictureTaken() in CameraListener()

Open GhassenMsd opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug

  • CameraView version: 2.7.2
  • Camera engine used: camera1 (by default)
  • Reproducible in official demo app: unknonw
  • Device / Android version: Samsung SM-G980F, Google Pixel 5 API 31
  • I have read the FAQ page: yes

To Reproduce

  • I can't reproduce myself, we are receiving bugsnags on some devices in our production app.

Expected behavior

  • Not crashing maybe or handle the error.

XML layout

Part of the XML layout with the CameraView declaration, so we can read its attributes.

<com.otaliastudios.cameraview.CameraView
        android:id="@+id/view_camera"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:cameraAudio="off"
        app:cameraFacing="back"
        app:cameraMode="picture"
        app:cameraPictureFormat="jpeg"
        app:cameraUseDeviceOrientation="false" />

Screenshots

Capture d’écran 2022-05-03 à 09 59 46

Logs

java.lang.NullPointerException · Attempt to get length of null arrayRawCameraUtils:317 com.otaliastudios.cameraview.CameraUtils.decodeBitmapCameraUtils:34 com.otaliastudios.cameraview.CameraUtils.access$000CameraUtils.java:216 com.otaliastudios.cameraview.CameraUtils$2.runHandler.java:938 android.os.Handler.handleCallbackHandler.java:99 android.os.Handler.dispatchMessageLooper.java:226 android.os.Looper.loopOnceLooper.java:313 android.os.Looper.loopHandlerThread.java:67 android.os.HandlerThread.run

GhassenMsd avatar May 03 '22 09:05 GhassenMsd

Similar issue here but this time it is for writing empty data to OutputStream

Fatal Exception: java.lang.NullPointerException: Attempt to get length of null array
       at java.io.FilterOutputStream.write(FilterOutputStream.java:103)
       at com.otaliastudios.cameraview.CameraUtils.writeToFile(CameraUtils.java:93)
       at com.otaliastudios.cameraview.CameraUtils$1.run(CameraUtils.java:121)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:223)
       at android.os.HandlerThread.run(HandlerThread.java:67)

qsdigor avatar Jun 06 '22 11:06 qsdigor