We are occasionally getting the following error and stack trace when opening our barcode scanner multiple times:
Java.Lang.IllegalStateException: The selected camera does not support the enabled use cases. Please disable use case and/or select a different camera. e.g. #setVideoCaptureEnabled(false)
---> Java.Lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 0. May be attempting to bind too many use cases. Existing surfaces: [AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=PRIV, configSize=PREVIEW, streamUseCase=0}, imageFormat=34, size=1600x1200, dynamicRange=DynamicRange@7c2ffb{encoding=SDR, bitDepth=8}, captureTypes=[PREVIEW], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@99017b0, targetFrameRate=null}, AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=YUV, configSize=PREVIEW, streamUseCase=0}, imageFormat=35, size=1280x720, dynamicRange=DynamicRange@7c2ffb{encoding=SDR, bitDepth=8}, captureTypes=[IMAGE_ANALYSIS], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@b95adae, targetFrameRate=null}] New configs: [androidx.camera.core.impl.PreviewConfig@72eb01, androidx.camera.core.impl.ImageAnalysisConfig@a2363d]
--- End of managed Java.Lang.IllegalArgumentException stack trace ---
java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 0. May be attempting to bind too many use cases. Existing surfaces: [AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=PRIV, configSize=PREVIEW, streamUseCase=0}, imageFormat=34, size=1600x1200, dynamicRange=DynamicRange@7c2ffb{encoding=SDR, bitDepth=8}, captureTypes=[PREVIEW], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@99017b0, targetFrameRate=null}, AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=YUV, configSize=PREVIEW, streamUseCase=0}, imageFormat=35, size=1280x720, dynamicRange=DynamicRange@7c2ffb{encoding=SDR, bitDepth=8}, captureTypes=[IMAGE_ANALYSIS], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@b95adae, targetFrameRate=null}] New configs: [androidx.camera.core.impl.PreviewConfig@72eb01, androidx.camera.core.impl.ImageAnalysisConfig@a2363d]
at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera(LifecycleCameraRepository.java:302)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:652)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:415)
at androidx.camera.view.ProcessCameraProviderWrapperImpl.bindToLifecycle(ProcessCameraProviderWrapperImpl.java:67)
at androidx.camera.view.LifecycleCameraController.startCamera(LifecycleCameraController.java:141)
at androidx.camera.view.CameraController.startCameraAndTrackStates(CameraController.java:1933)
at androidx.camera.view.CameraController.startCameraAndTrackStates(CameraController.java:1922)
at androidx.camera.view.LifecycleCameraController.bindToLifecycle(LifecycleCameraController.java:97)
at crc640ec207abc449b2ca.ShellContentFragment.n_onAnimationEnd(Native Method)
at crc640ec207abc449b2ca.ShellContentFragment.onAnimationEnd(ShellContentFragment.java:78)
at android.view.animation.Animation.dispatchAnimationEnd(Animation.java:1118)
at android.view.animation.Animation.fireAnimationEnd(Animation.java:1099)
at android.view.animation.Animation.getTransformation(Animation.java:1053)
at android.view.animation.Animation.getTransformation(Animation.java:1137)
at android.view.animation.AnimationSet.getTransformation(AnimationSet.java:404)
at android.view.animation.Animation.getTransformation(Animation.java:1137)
at android.view.View.applyLegacyAnimation(View.java:23733)
at android.view.View.draw(View.java:23858)
at android.view.ViewGroup.drawChild(ViewGroup.java:4566)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4327)
at android.view.View.draw(View.java:24193)
at android.view.View.updateDisplayListIfDirty(View.java:23056)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4550)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4523)
at android.view.View.updateDisplayListIfDirty(View.java:23012)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:694)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:700)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:798)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:5234)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4900)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4049)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2659)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9789)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1399)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1408)
at android.view.Choreographer.doCallbacks(Choreographer.java:1008)
at android.view.Choreographer.doFrame(Choreographer.java:938)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1382)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8501)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
--- End of managed Java.Lang.IllegalArgumentException stack trace ---
java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 0. May be attempting to bind too many use cases. Existing surfaces: [AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=PRIV, configSize=PREVIEW, streamUseCase=0}, imageFormat=34, size=1600x1200, dynamicRange=DynamicRange@7c2ffb{encoding=SDR, bitDepth=8}, captureTypes=[PREVIEW], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@99017b0, targetFrameRate=null}, AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=YUV, configSize=PREVIEW, streamUseCase=0}, imageFormat=35, size=1280x720, dynamicRange=DynamicRange@7c2ffb{encoding=SDR, bitDepth=8}, captureTypes=[IMAGE_ANALYSIS], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@b95adae, targetFrameRate=null}] New configs: [androidx.camera.core.impl.PreviewConfig@72eb01, androidx.camera.core.impl.Image...
So far this has only happened on Pixel devices.
This is how our scanner is set up:
Page is opened in a transient view and view model
EnableCamera is set to true in the view model on the shell Navigated event
EnableCamera is set to false in the view model on the shell Navigating event
The content page is set up to call DisconnectHandler when the page is unloaded
We are occasionally getting the following error and stack trace when opening our barcode scanner multiple times:
So far this has only happened on Pixel devices.
This is how our scanner is set up:
EnableCamera
is set to true in the view model on the shellNavigated
eventEnableCamera
is set to false in the view model on the shellNavigating
eventDisconnectHandler
when the page is unloaded