java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null object reference

GitHub | remq | 5 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    NULL reference exception on takePicture()

    GitHub | 5 months ago | remq
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null object reference
  2. 0

    GitHub comment 55#268214701

    GitHub | 2 months ago | DaviddeMiguel
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'int android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null object reference

      at com.google.android.cameraview.Camera2.unlockFocus()
    2. com.google.android
      Camera2$6.onCaptureCompleted
      1. com.google.android.cameraview.Camera2.unlockFocus(Camera2.java:625)
      2. com.google.android.cameraview.Camera2.access$900(Camera2.java:45)
      3. com.google.android.cameraview.Camera2$6.onCaptureCompleted(Camera2.java:609)
      3 frames
    3. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    4. Android
      HandlerDispatcher$1.run
      1. android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
      2. android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
      2 frames
    5. Android Platform
      ActivityThread.main
      1. android.os.Handler.handleCallback(Handler.java:739)
      2. android.os.Handler.dispatchMessage(Handler.java:95)
      3. android.os.Looper.loop(Looper.java:135)
      4. android.app.ActivityThread.main(ActivityThread.java:5569)
      4 frames
    6. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    7. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:931)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:726)
      2 frames