CameraDeepAR icon indicating copy to clipboard operation
CameraDeepAR copied to clipboard

[Android] Attmpt to invoke method setAREventListener on null object reference

Open michaelgaultjr opened this issue 3 years ago • 4 comments
trafficstars

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

  1. Create and Initialize an instance of CameraDeepArController
  2. Call controller.dispose in the dispose method of the widget
  3. 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

michaelgaultjr avatar Dec 29 '21 17:12 michaelgaultjr

Thanks I'd take a look

mtellect avatar Dec 29 '21 19:12 mtellect

Is there any updates with this issue?

IraDolynska avatar Jun 23 '22 09:06 IraDolynska

Any change?

IgorTurcan avatar Feb 27 '23 13:02 IgorTurcan

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

michaelgaultjr avatar Feb 27 '23 15:02 michaelgaultjr