nativescript-ar
nativescript-ar copied to clipboard
Android crash on back navigation while HandMotionAnimation is visible
seems to consistently crash on a back navigation while the hand motion animation (detect a plane) is visible. this is not an issue for FaceDetection, or ImageDetection modes
System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getWidth()' on a null object reference
System.err: at com.google.ar.sceneform.ux.HandMotionAnimation.applyTransformation(HandMotionAnimation.java:48)
Android Pixel2 (Android 10)
I fixed the issue in my application by adding following snippet. (added in my app on page events)
beforeDisposeNativeViewNavigation(){
//let _fragment=ar.getFragment();
_fragment.getPlaneDiscoveryController().hide();
_fragment.getPlaneDiscoveryController().setInstructionView(null);
}
I'm not sure exactly how this would be added to ar.android.ts - it needs to be executed before the page transition occurs (disposeNativeView happens after navigation )