Open DanielDent opened 3 years ago
I also get the following crash sometimes, which may or may not be related. I think the following line is responsible:
There's a possibility that either 1 or both of these crashes may have something to do with how the app behaves if it gets backgrounded while the camera view is open.
Fatal Exception: com.tns.NativeScriptException: Calling js method run failed
TypeError: Cannot read property 'getMeasuredWidth' of null
at com.tns.Runtime.callJSMethodNative(Runtime.java)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
at com.tns.Runtime.callJSMethod(Runtime.java:1160)
at com.tns.Runtime.callJSMethod(Runtime.java:1138)
at com.tns.Runtime.callJSMethod(Runtime.java:1134)
at com.tns.gen.java.lang.Runnable.run(Runnable.java:17)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8034)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
I can fairly consistently reproduce the getMeasuredWidth null crash by rotating an Android device when the barcode scanner is opening. Looking at the code, it looks like there's a race condition where surfaceView may no longer be around by the time that fixStretch is operating on it.
I've noticed on occasion that there is a crash that seems to be related to when I am using and/or opening/closing a MLKitBarcodeScanner at the same time as I am moving the device such that it moves between landscape/portrait or portrait/landscale. I've never managed to consistently reproduce it myself in testing.
I've been getting the crash below showing up a bunch in Crashlytics and I am fairly certain it's related to: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/faa9058e3d882c301f36dd205768c0a2f892bbd3/src/mlkit/mlkit-cameraview.android.ts#L438