Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

app crash when adding any android component to SceneObject #2020

Open spakanati123 opened 5 years ago

spakanati123 commented 5 years ago

Hi, all of sudden our app started crashing on launch and the crash is happening while adding any Android component to the SceneObject. I can reproduce the issue on given demo's gvr-events as well. The crash trace is:

11-10 01:12:12.568 32440-32440/org.gearvrf.events E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.gearvrf.events, PID: 32440
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
        at android.view.ViewGroup.addViewInner(ViewGroup.java:5122)
        at android.view.ViewGroup.addView(ViewGroup.java:4953)
        at android.view.ViewGroup.addView(ViewGroup.java:4893)
        at android.view.ViewGroup.addView(ViewGroup.java:4866)
        at org.gearvrf.scene_objects.GVRViewSceneObject.addView(GVRViewSceneObject.java:273)
        at org.gearvrf.scene_objects.GVRViewSceneObject.access$100(GVRViewSceneObject.java:69)
        at org.gearvrf.scene_objects.GVRViewSceneObject$1.run(GVRViewSceneObject.java:215)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6938)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Requesting a quick update on this. Thanks in advance

ragner commented 5 years ago

Hi @spakanati123, Which constructor of GVRViewSceneObject are you using? What version of GVRf are your using? What branch of GVRf-Demos are you on?

spakanati123 commented 5 years ago

@ragner seems my demo branch is old and with the updated one it's working fine. I can see API diff to register android layout in the commit: https://github.com/gearvrf/GearVRf-Demos/commit/51c5d35a528dfa7bf53cd796f2d308f4d6d846aa#diff-7bcfc0e30ec452a2b0ad5aefb0c6b022

spakanati123 commented 5 years ago

@ragner when i am checking the gvr-videoplayer demo app the cursor not working with remote controller only in player screen when playing video(galley scene no issue) but it's working fine with track pad in player scene as well on samsung gear VR headset. This is logic i seen in demo app.

   private void initCursorController() {
        mScene.getEventReceiver().addListener(mTouchHandler);
        GVRInputManager inputManager = mContext.getInputManager();
        inputManager.selectController(new GVRInputManager.ICursorControllerSelectListener() {
            public void onCursorControllerSelected(GVRCursorController newController, GVRCursorController oldController) {
                if (oldController != null) {
                    oldController.removePickEventListener(mTouchHandler);
                }
                mCursorController = newController;
                newController.addPickEventListener(mTouchHandler);
                newController.setCursor(createCursor());
                newController.setCursorDepth(-CURSOR_DEPTH);
                newController.setCursorControl(GVRCursorController.CursorControl.CURSOR_CONSTANT_DEPTH);
            }
        });
    }

But if i use built in API gvrContext.getInputManager().selectController(); remote working fine but this API not helpful for doing any customiztion , please suggest to fix the issue on demo app gvr-videoplayer.

I am using galaxy S8 device with Samsung Gear VR headset

liaxim commented 5 years ago

@spakanati123 The cursor is not working in what way? I tried and it works pretty good if you use the trigger button for clicking. If you are clicking via the touch pad then there might be a problem which is a known issue. Is there any other demo app in which you experience this issue?