nativescript-ar icon indicating copy to clipboard operation
nativescript-ar copied to clipboard

Android crash on back navigation while HandMotionAnimation is visible

Open nickolanack opened this issue 5 years ago • 1 comments

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)

nickolanack avatar Dec 28 '19 22:12 nickolanack

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 )

nickolanack avatar Dec 30 '19 09:12 nickolanack