CameraDeepAR
CameraDeepAR copied to clipboard
[Android] Attmpt to invoke method setAREventListener on null object reference
Problem
After calling cameraDeepArController.dispose on Android this platform exception is thrown.
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'void ai.deepar.ar.DeepAR.setAREventListener(ai.deepar.ar.AREventListener)' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'void ai.deepar.ar.DeepAR.setAREventListener(ai.deepar.ar.AREventListener)' on a null object reference
The app continues to work if you continue in the debugger, however when the DeepAR camera is loaded again the effects do not get applied, and when the controller gets disposed again, the same exception gets thrown, and not calling controller.dispose makes everything to work properly with no issues.
Steps to reproduce
- Create and Initialize an instance of
CameraDeepArController - Call
controller.disposein thedisposemethod of the widget - Dispose of the widget
Possible Cause
After looking through the code a bit it seems that this line which sets in HandleCameraDeepAr.java could be the cause
https://github.com/mtellect/CameraDeepAR/blob/32ba7e9c8d08a4dbcb69a6e124e768b82b800162/android/src/main/java/com/camera_deep_ar/handlers/HandleDeepAr.java#L249
Thanks I'd take a look
Is there any updates with this issue?
Any change?
I don't think there has been any updates on this, however DeepAR has created their own Flutter plugin, I haven't had a chance to try it out yet, but it's their official plugin, so I'd imagine it's pretty stable. https://github.com/DeepARSDK/deepar-flutter-plugin