-
Notifications
You must be signed in to change notification settings - Fork 1k
java.lang.IllegalStateException: Session has been closed; further changes are illegal. #11
Comments
Seems like this is happening when the views visibility is initially set to GONE |
I am facing the same issue when trying the sample: on first start after granting permission the app crashes. Subsequent starts are successful and the app is working as expected. I added a longer logcat output from my device - Sony Xperia Z3 / running on Android 6.0.1
|
Note that this also seems to happen when you put your .stop call AFTER the super call in your onPause, instead of before. Could be the issue here as well. |
Same problem happen to me on nexus 5x 7.0. stoyicker solution doesn't work |
Happens to me if you lock/unlock the screen. Same code added to a different empty Activity works just fine. Yet didn't find what so special about the first one. |
Seeing this as well. Happens specifically when the camera view is hidden (in my case, the camera view is behind another view which is shown later after the user taps a button). |
When I remove the callback in mPreview I no longer get this exception (i.e. remove https://github.com/google/cameraview/blob/master/library/src/main/api21/com/google/android/cameraview/Camera2.java#L191...L196). Is this safe to remove or would that have unintended consequences? |
try to update to compile "com.android.support:support-v4:25.2.0" |
I can see the pull request, but is it going to be merged? The bug still exists |
It seems like this was occurring for me when I
Seems to work! |
Well, after try many ways, I got a kind of solution. I just wanted when I stop the camera, I also want to hide the CameraView. My first trying was like that, and I got the issue Session has been closed; further changes are illegal.
Then, I just had a look at the callback CameraView.Callback and I realised that it has two methods onCameraOpened() and onCameraClosed(). I just put the setVisibles in those methods and I didn't get more issues anymore.
Sorry for my english. |
I guess some devices don't support some aspect ratios. The default aspect ratio is 4:3 and I was getting this error on LG G4. I tried changing the aspect ratio in The code:
Edit: Actually, just set the aspectRatio before starting the camera. |
Ended up switching to Fotoapparat. |
Was this closed just because the reporter ended up using a different solution? I'm still seeing this in my own project running on a Pixel. |
Update README with current lib version
No success here, what I had to do (no time as always) is that I implemented a onCrash() callback Yes yes, I know. |
When calling
cameraView.start();
I get the following exception:Note: I'm not calling it in
onResume
. Rather after the Camera permisison has been granted.The text was updated successfully, but these errors were encountered: