jitsi / jitsi-meet-sdk-samples

Jitsi Meet mobile SDK examples (Android, iOS and React Native)
Apache License 2.0
281 stars 239 forks source link

Pausing an activity that is not the current activity, this is incorrect! #47

Closed Dewsworld closed 4 years ago

Dewsworld commented 4 years ago

I am using android java code and getting this error. I am using the example code given at this repository.

java.lang.AssertionError: Pausing an activity that is not the current activity, this is incorrect! Current activity: JitsiMeetActivity Paused activity: StreamActivity at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72) at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:511) at org.jitsi.meet.sdk.JitsiMeetActivityDelegate.onHostPause(JitsiMeetActivityDelegate.java:126) at org.jitsi.meet.sdk.JitsiMeetFragment.onStop(JitsiMeetFragment.java:94) at androidx.fragment.app.Fragment.performStop(Fragment.java:2894) at androidx.fragment.app.FragmentStateManager.stop(FragmentStateManager.java:381) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1209) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354) at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495) at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2617) at androidx.fragment.app.FragmentManager.dispatchStop(FragmentManager.java:2590) at androidx.fragment.app.FragmentController.dispatchStop(FragmentController.java:291) at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:563) at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1466) at android.app.Activity.performStop(Activity.java:8018) at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4616) at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4594) at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4669) at android.app.servertransaction.StopActivityItem.execute(StopActivityItem.java:41) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

saghul commented 4 years ago

Can you reliably reproduce this? I don’t think we have a StreamActivity in this repo, did you add it yourself?

A test repo which can reproduce the issue would be very helpful here.

Dewsworld commented 4 years ago

Can you reliably reproduce this? I don’t think we have a StreamActivity in this repo, did you add it yourself?

A test repo which can reproduce the issue would be very helpful here.

StreamActivity is in our code. I was invoking launch function from StreamActivity.

Alternatively, I was able to run the other code (Jitsi View implementation) to work.

saghul commented 4 years ago

Can you provide a small test project so we can try to fix the problem? I cannot reproduce it with the SDK samples we have.

djerick1989 commented 4 years ago

Hi @saghul

That error happen when you leave the conference, in the logcat windows clears quickly and remove that error. I am thinking for this reason i do not receiving the Override method call onConferenceTerminated

2020-05-28 06:27:13.170 18236-18236/com.jobconvo.live E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.jobconvo.live, PID: 18236
    java.lang.AssertionError: Pausing an activity that is not the current activity, this is incorrect! Current activity: JitsiActivity Paused activity: JitsiMeetActivity
        at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
        at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:511)
        at org.jitsi.meet.sdk.JitsiMeetActivityDelegate.onHostPause(JitsiMeetActivityDelegate.java:125)
        at org.jitsi.meet.sdk.JitsiMeetFragment.onStop(JitsiMeetFragment.java:78)
        at androidx.fragment.app.Fragment.performStop(Fragment.java:2894)
        at androidx.fragment.app.FragmentStateManager.stop(FragmentStateManager.java:381)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1209)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2617)
        at androidx.fragment.app.FragmentManager.dispatchStop(FragmentManager.java:2590)
        at androidx.fragment.app.FragmentController.dispatchStop(FragmentController.java:291)
        at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:563)
        at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1487)
        at android.app.Activity.performStop(Activity.java:8319)
        at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5240)
        at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:5218)
        at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5293)
        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:247)
        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:215)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:187)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8178)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
2020-05-28 06:27:13.172 18236-18236/com.jobconvo.live E/JitsiMeetSDK: JitsiMeetUncaughtExceptionHandler FATAL ERROR
    java.lang.AssertionError: Pausing an activity that is not the current activity, this is incorrect! Current activity: JitsiActivity Paused activity: JitsiMeetActivity
        at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
        at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:511)
        at org.jitsi.meet.sdk.JitsiMeetActivityDelegate.onHostPause(JitsiMeetActivityDelegate.java:125)
        at org.jitsi.meet.sdk.JitsiMeetFragment.onStop(JitsiMeetFragment.java:78)
        at androidx.fragment.app.Fragment.performStop(Fragment.java:2894)
        at androidx.fragment.app.FragmentStateManager.stop(FragmentStateManager.java:381)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1209)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2617)
        at androidx.fragment.app.FragmentManager.dispatchStop(FragmentManager.java:2590)
        at androidx.fragment.app.FragmentController.dispatchStop(FragmentController.java:291)
        at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:563)
        at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1487)
        at android.app.Activity.performStop(Activity.java:8319)
        at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5240)
        at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:5218)
        at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5293)
        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:247)
        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:215)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:187)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8178)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

    java.lang.AssertionError: Pausing an activity that is not the current activity, this is incorrect! Current activity: JitsiActivity Paused activity: JitsiMeetActivity
        at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
        at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:511)
        at org.jitsi.meet.sdk.JitsiMeetActivityDelegate.onHostPause(JitsiMeetActivityDelegate.java:125)
        at org.jitsi.meet.sdk.JitsiMeetFragment.onStop(JitsiMeetFragment.java:78)
        at androidx.fragment.app.Fragment.performStop(Fragment.java:2894)
        at androidx.fragment.app.FragmentStateManager.stop(FragmentStateManager.java:381)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1209)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1354)
        at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1432)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1495)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2617)
        at androidx.fragment.app.FragmentManager.dispatchStop(FragmentManager.java:2590)
        at androidx.fragment.app.FragmentController.dispatchStop(FragmentController.java:291)
        at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:563)
        at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1487)
        at android.app.Activity.performStop(Activity.java:8319
erandakarachchi commented 4 years ago

Try by finishing the current activity.

JitsiMeetActivity.launch(this, options); this.finish();

akteruzzaman816 commented 4 years ago

@Dewsworld You have an activity that's name is StreamActivity . So please extends that activity with AppCompatActivity instead of JitsiMeetActivity.I think this will solve your problem

Dewsworld commented 4 years ago

Try by finishing the current activity.

JitsiMeetActivity.launch(this, options); this.finish();

This works

littlehome-eugene commented 3 years ago

Try by finishing the current activity. JitsiMeetActivity.launch(this, options); this.finish();

This works

@Dewsworld

We are having similar problem. Can you show us the previous code that was turned into the following code?

JitsiMeetActivity.launch(this, options);
this.finish();

Or any plausible explanation what might have caused it?

We are having hard time applying the solution..

swapnilgt commented 2 years ago

We had a similar issue. We were earlier doing something like this:

this.finish();
JitsiMeetActivity.launch(this, options);

which then we changed to:

JitsiMeetActivity.launch(this, options);
this.finish();

The crash stopped happening because of this, but not sure why. Can someone help understanding this?

saghul commented 2 years ago

That makes sense. The current activity must exist and not be finished when launching a new activity. So it makes sense that you fix the error by not finishing the current activity until the new one is launched with the current one as the "parent".