Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

App crash on Android sessionDisconnected #211

Open
asaf-interator opened this issue Dec 22, 2021 · 3 comments
Open

App crash on Android sessionDisconnected #211

asaf-interator opened this issue Dec 22, 2021 · 3 comments

Comments

@asaf-interator
Copy link

Bug Report

Current behavior
App crash on Android sessionDisconnected

Steps to reproduce

Create a video call between two devices and after it's initiates one device terminates the call

What is the current bug behavior?
We're able to have a video call between two devices and when one of the devices ends the call the app crash sometimes on Android devices

What is the expected correct behavior?
Call is disconnected and app continue to work normally

Relevant logs and/or screenshots
2021-12-22 13:23:17.683 15462-18346/? E/AndroidRuntime: FATAL EXCEPTION: JavaBridge
Process: <bundle_id> PID: 15462
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:9425)
at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1769)
at android.view.View.requestLayout(View.java:25595)
at android.view.View.requestLayout(View.java:25595)
at android.view.View.requestLayout(View.java:25595)
at android.view.View.requestLayout(View.java:25595)
at android.view.View.requestLayout(View.java:25595)
at android.view.ViewGroup.removeView(ViewGroup.java:5488)
at com.tokbox.cordova.OpenTokAndroidPlugin$RunnablePublisher.destroyPublisher(OpenTokAndroidPlugin.java:262)
at com.tokbox.cordova.OpenTokAndroidPlugin.onDisconnected(OpenTokAndroidPlugin.java:746)
at com.opentok.android.Session.e(Unknown Source:4)
at com.opentok.android.Session.lambda$_BO8aFRZOCxxkew6Gy77xEyyaHo(Unknown Source:0)
at com.opentok.android.-$$Lambda$Session$_BO8aFRZOCxxkew6Gy77xEyyaHo.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:233)
at android.os.HandlerThread.run(HandlerThread.java:67)

@mishraabinash729
Copy link

I also got the same above error

Solution

Try to use below plugin

cordova plugin remove cordova-plugin-opentok

cordova plugin add napa-cordova-plugin-opentok

It'll resolve the issue

@asaf-interator
Copy link
Author

@mishraabinash729 Hi, thanks, but I still have the issue after installing napa-cordova-plugin-opentok

@maxwell09
Copy link

maxwell09 commented Dec 16, 2022

Hi, a bit late but this is solved in talkspiritlab/cordova-plugin-opentok, checkOpenTokAndroidPlugin.java

Basically, they added this function in RunnableUpdateViews:

public void removeView() { cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { ViewGroup parent = (ViewGroup) webView.getView().getParent(); parent.removeView(mView); } }); }

And replaced these:

ViewGroup parent = (ViewGroup) webView.getView().getParent();
parent.removeView(this.mView);

With this:

this.removeView();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants