triniwiz / fancycamera

MIT License
8 stars 13 forks source link

Crash - No supported surface combination is found for camera device #34

Open timdoege opened 9 months ago

timdoege commented 9 months ago

This may be more a question than a bug-report, but here goes:

The NativeScript MLKit plugin v2.0.0 is using 'io.github.triniwiz:fancycamera:3.0.6'

and after releasing a new version of our app with that plugin (for barcode scanning), we are getting crash reports in Crashlytics containing:

 Caused by 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}, imageFormat=34, size=1440x1080, targetFrameRate=null}, 
AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=YUV, configSize=VGA}, imageFormat=35, size=640x480, targetFrameRate=null}] New configs: [androidx.camera.core.impl.ImageAnalysisConfig@3cea91e, 
androidx.camera.core.impl.PreviewConfig@cece959]

with trace

 Caused by 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}, imageFormat=34, size=1440x1080, targetFrameRate=null}, 
AttachedSurfaceInfo{surfaceConfig=SurfaceConfig{configType=YUV, configSize=VGA}, imageFormat=35, size=640x480, targetFrameRate=null}] New configs: [androidx.camera.core.impl.ImageAnalysisConfig@3cea91e, androidx.camera.core.impl.PreviewConfig@cece959]
androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera (LifecycleCameraRepository.java:285)
androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle (ProcessCameraProvider.java:363)
io.github.triniwiz.fancycamera.Camera2.initPreview (Camera2.kt:909)
io.github.triniwiz.fancycamera.Camera2.refreshCamera (Camera2.kt:984)
io.github.triniwiz.fancycamera.Camera2.startPreview (Camera2.kt:1035)
io.github.triniwiz.fancycamera.FancyCamera.startPreview (FancyCamera.kt:365)
com.tns.Runtime.callJSMethodNative (Runtime.java)
com.tns.Runtime.dispatchCallJSMethodNative (Runtime.java:1301)
com.tns.Runtime.callJSMethodImpl (Runtime.java:1187)
com.tns.Runtime.callJSMethod (Runtime.java:1174)
com.tns.Runtime.callJSMethod (Runtime.java:1152)
com.tns.Runtime.callJSMethod (Runtime.java:1148)
com.tns.FragmentClass.onCreateView (FragmentClass.java:55)
androidx.fragment.app.Fragment.performCreateView (Fragment.java:3104)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067) 

Unfortunately, I cannot reproduce this in a simple test case.

Is there anything you know of that can avoid this?

nhuurnink commented 5 months ago

Hi there,

We have the same issue that is reported since a few days, we didn't release a new version of our Nativescript app in a year or so. The stacktrace I'm getting is:

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.deliverResults (ActivityThread.java:6007)
  at android.app.ActivityThread.handleSendResult (ActivityThread.java:6046)
  at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:67)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2571)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8741)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Caused by com.tns.NativeScriptException:
  at com.tns.Runtime.callJSMethodNative
  at com.tns.Runtime.dispatchCallJSMethodNative (Runtime.java:1298)
  at com.tns.Runtime.callJSMethodImpl (Runtime.java:1184)
  at com.tns.Runtime.callJSMethod (Runtime.java:1171)
  at com.tns.Runtime.callJSMethod (Runtime.java:1149)
  at com.tns.Runtime.callJSMethod (Runtime.java:1145)
  at com.tns.NativeScriptActivity.onRequestPermissionsResult (NativeScriptActivity.java:65)
  at android.app.Activity.dispatchRequestPermissionsResult (Activity.java:9111)
  at android.app.Activity.dispatchActivityResult (Activity.java:8942)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:6000)
Caused by java.lang.IllegalArgumentException:
  at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera (LifecycleCameraRepository.java:285)
  at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle (ProcessCameraProvider.java:538)
  at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle (ProcessCameraProvider.java:363)
  at io.github.triniwiz.fancycamera.Camera2.initPreview (Camera2.kt:909)
  at io.github.triniwiz.fancycamera.Camera2.refreshCamera (Camera2.kt:984)
  at io.github.triniwiz.fancycamera.Camera2.startPreview (Camera2.kt:1035)
  at io.github.triniwiz.fancycamera.FancyCamera.startPreview (FancyCamera.kt:365)
  at io.github.triniwiz.fancycamera.FancyCamera.onPermissionHandler (FancyCamera.kt:444)
nhuurnink commented 4 months ago

Hi triniwiz, Do you have an expectation when you have time to look into this issue? Our production app is failing completely now, so our customers would like to know what they can expect.