You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i sometimes (not always) get an IllegalArgumentExcpetion while asking for cameraPermissions in my app. My code is as follows:
this.camera.requestCameraPermission().then(()=>{this.camera.pause=false;}).catch((e)=>{console.log("Error no permission");}
I do this everytime the MLKitView gets loaded.
The catch is not reached instead i get
--------- beginning of crash
07-11 16:13:21.423 19154 19154 E AndroidRuntime: FATAL EXCEPTION: main
07-11 16:13:21.423 19154 19154 E AndroidRuntime: Process: PACKAGENAME, PID: 19154
07-11 16:13:21.423 19154 19154 E AndroidRuntime: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=868, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {PACKAGENAME/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onRequestPermissionsResult failed
07-11 16:13:21.423 19154 19154 E AndroidRuntime: Error: 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@632259a, androidx.camera.core.impl.PreviewConfig@f0eda45]
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:5589)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.ActivityThread.handleSendResult(ActivityThread.java:5630)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.os.Looper.loop(Looper.java:219)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8349)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: Caused by: com.tns.NativeScriptException: Calling js method onRequestPermissionsResult failed
07-11 16:13:21.423 19154 19154 E AndroidRuntime: Error: 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@632259a, androidx.camera.core.impl.PreviewConfig@f0eda45]
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.Runtime.callJSMethodNative(Native Method)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.Runtime.callJSMethod(Runtime.java:1175)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.Runtime.callJSMethod(Runtime.java:1153)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.Runtime.callJSMethod(Runtime.java:1149)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at com.tns.NativeScriptActivity.onRequestPermissionsResult(NativeScriptActivity.java:65)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:8566)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.Activity.dispatchActivityResult(Activity.java:8416)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at android.app.ActivityThread.deliverResults(ActivityThread.java:5582)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: ... 11 more
07-11 16:13:21.423 19154 19154 E AndroidRuntime: 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@632259a, androidx.camera.core.impl.PreviewConfig@f0eda45]
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at androidx.camera.lifecycle.LifecycleCameraRepository.bindToLifecycleCamera(LifecycleCameraRepository.java:285)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:538)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:363)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at io.github.triniwiz.fancycamera.Camera2.initPreview(Camera2.kt:909)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at io.github.triniwiz.fancycamera.Camera2.refreshCamera(Camera2.kt:984)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at io.github.triniwiz.fancycamera.Camera2.startPreview(Camera2.kt:1035)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at io.github.triniwiz.fancycamera.FancyCamera.startPreview(FancyCamera.kt:365)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: at io.github.triniwiz.fancycamera.FancyCamera.onPermissionHandler(FancyCamera.kt:444)
07-11 16:13:21.423 19154 19154 E AndroidRuntime: ... 21 more
07-12 09:56:46.721 7599 7599 E AndroidRuntime: FATAL EXCEPTION: main
I noticed the error occurs, when i quickly route between two components which both execute the above code.
I now check if the camera allready has permissions like so:
if(!this.camera.hasCameraPermission()){try{awaitthis.camera.requestCameraPermission()}catch(e){console.log("Error no permission");return;}}this.camera.pause=false;
and cannot trigger the error anymore.
Permissions were granted before triggering the error in either case.
I previously assumed that
this.camera.requestCameraPermission()
would internally check if it really has to ask for permissions and resolve immediately if permissions where allready granted, which seems not to be the case, leading to the error if it happens fast.
Hi,
i sometimes (not always) get an IllegalArgumentExcpetion while asking for cameraPermissions in my app. My code is as follows:
I do this everytime the MLKitView gets loaded.
The catch is not reached instead i get
i guess i'm doing it wrong - any hints welcome.
using:
"@angular/core": "~15.2.0",
"@nativescript/core": "~8.5.0",
"@nativescript/mlkit-barcode-scanning": "^2.0.0",
"@nativescript/mlkit-core": "^2.0.0",
Thank you in advance.
The text was updated successfully, but these errors were encountered: