question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mediaBrowser.connect() crash

See original GitHub issue

In android 8.0 or above, I met a problem.

when i called MediaBrowser.connect() ,it will crash sometimes.

Caused by java.lang.IllegalStateException: connect() called while neither disconnecting nor disconnected (state=CONNECT_STATE_CONNECTING) at android.media.browse.MediaBrowser.connect(MediaBrowser.java:152) at android.support.v4.media.MediaBrowserCompatApi21.connect(Unknown Source:2) at android.support.v4.media.MediaBrowserCompat$MediaBrowserImplApi21.connect(Unknown Source:2) at android.support.v4.media.MediaBrowserCompat.connect(Unknown Source:2)

Looks like connect() being called multiple times.But I called disconnect() in onStop().

I can’t reproduce it ,I just saw it in the fabric log.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Subudaycommented, Dec 1, 2019

I have also encounter this problem。How can i get the connect state,and i want use connect state avoid this crash。 Examle: if(mediaBrowser.getConnectState() != CONNECT_STATE_CONNECTING && !mediaBrowser.isConnected){ mediaBrowser.connect() }

Use this code in try catch block.

1reaction
rczhang13028commented, May 24, 2019

I have also encounter this problem。How can i get the connect state,and i want use connect state avoid this crash。 Examle: if(mediaBrowser.getConnectState() != CONNECT_STATE_CONNECTING && !mediaBrowser.isConnected){ mediaBrowser.connect() }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - mediaBrowser.connect() crash - - Bountysource
In android 8.0 or above, I met a problem. when i called MediaBrowser.connect() ,it will crash sometimes. Caused by java.lang.
Read more >
Building a media browser client - Android Developers
If the connection is successful, the onConnect() callback creates the media controller, links it to the media session, links your UI controls to ......
Read more >
java.lang.IllegalStateException in MediaBrowser - Stack ...
My audio streaming app have this issue in Crashlytics, with the stacktrace ... IllegalStateException: getExtras() called while not connected ...
Read more >
Server crash at startup - Linux - Emby Community
I get the following error: 2016-10-31 19:06:18.6321 Info ConnectManager: Loading data from /var/lib/emby-server/data/connect.txt 2016-10-31 ...
Read more >
Diff - platform/packages/apps/Car/Media
Prompt text to display when we failed to connect to a media app. ... mController has been disconnected before we call MediaBrowser.connect() -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found