camera-samples icon indicating copy to clipboard operation
camera-samples copied to clipboard

Camera2 Basic - NullPointerException

Open anonym24 opened this issue 3 years ago • 0 comments
trafficstars

The second time I try to take photo the sample app crashes with the next error:

2022-04-01 16:38:36.235 9849-9849/com.android.example.camera2.basic E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.android.example.camera2.basic, PID: 9849
    java.lang.NullPointerException
        at com.example.android.camera2.basic.fragments.CameraFragment.getFragmentCameraBinding(CameraFragment.kt:79)
        at com.example.android.camera2.basic.fragments.CameraFragment.access$getFragmentCameraBinding(CameraFragment.kt:74)
        at com.example.android.camera2.basic.fragments.CameraFragment$animationTask$2.invoke$lambda-1$lambda-0(CameraFragment.kt:117)
        at com.example.android.camera2.basic.fragments.CameraFragment$animationTask$2.lambda$kSaIYQrPru2VxvpYHL5tPwU4w3s(Unknown Source:0)
        at com.example.android.camera2.basic.fragments.-$$Lambda$CameraFragment$animationTask$2$kSaIYQrPru2VxvpYHL5tPwU4w3s.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:938)

So it takes photo with success only for the first time

Android 30+ tested devices

anonym24 avatar Apr 01 '22 13:04 anonym24