java.lang.IllegalStateException: Session has been closed; further changes are illegal.
See original GitHub issueWhen calling cameraView.start();
I get the following exception:
java.lang.IllegalStateException: Session has been closed; further changes are illegal. at android.hardware.camera2.impl.CameraCaptureSessionImpl.checkNotClosed(CameraCaptureSessionImpl.java:606) at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:227) at com.google.android.cameraview.Camera2$3.onConfigured(Camera2.java:132) at java.lang.reflect.Method.invoke(Native Method) at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39) at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Note: I’m not calling it in onResume
. Rather after the Camera permisison has been granted.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:15 (2 by maintainers)
Same problem happen to me on nexus 5x 7.0. stoyicker solution doesn’t work
It seems like this was occurring for me when I
setVisibility(VISIBLE)
and then immediately attempted tostart()
theCameraView
. My workaround: do the visibility change andpost
thestart()
to allow it time for the view to be ready.Seems to work!