SceneView / sceneview-flutter

SceneView Flutter is a 3D and AR Flutter Android View with Google Filament and ARCore. This is a Sceneform replacement in Flutter
Apache License 2.0
25 stars 14 forks source link

App crashes when using PlatformViewLink (but works with AndroidView) #11

Open engor opened 7 months ago

engor commented 7 months ago

The SceneView widget is based on PlanformViewLink. And example app crashes after I turn on camera permission.

Device: Samsung Galaxy S10

Solution: replace PlatformViewLink with AndroidView (don't know about possible disadvantages):

return AndroidView(
  viewType: viewType,
  layoutDirection: TextDirection.ltr,
  creationParams: creationParams,
  creationParamsCodec: const StandardMessageCodec(),
  onPlatformViewCreated: onPlatformViewCreated,
);
MustaphaELO commented 1 month ago

Hello, Any updates here i'm facing the same issue (i tested with three different physical android phones) here is the thrown Exception:

FATAL EXCEPTION: main Process: io.github.sceneview.sceneview_flutter_example, PID: 16559 com.google.ar.core.exceptions.FatalException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at com.google.ar.core.Session.throwExceptionFromArStatus(Session.java:16) at com.google.ar.core.Session.nativeUpdate(Native Method) at com.google.ar.core.Session.update(Session.java:2) at io.github.sceneview.ar.arcore.ARSession.updateOrNull(ArSession.kt:102) at io.github.sceneview.ar.ARSceneView.onFrame(ARSceneView.kt:475) at io.github.sceneview.SceneView$FrameCallback.doFrame(SceneView.kt:695) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:997) at android.view.Choreographer.doCallbacks(Choreographer.java:797) at android.view.Choreographer.doFrame(Choreographer.java:728) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:984) 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:8167) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

The proposed solution above (using AndroidView) works but it has limitation (example: app crashes while trying to rotate the phone to landscape , and other limitation i have faced while my integration) Any updates would be appreciated, Thanks