Audio_service: onStop crashing app in example project

Created on 10 Sep 2020  Â·  1Comment  Â·  Source: ryanheise/audio_service


Which API doesn't behave as documented, and how does it misbehave?

When the onStop() method is called, everything goes well until super.onStop() is called, and more specifically, when it runs _backgroundChannel.invokeMethod('stopped').

I receive the following error:

Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: 37

I was running into this issue in my project and assumed it was something I was doing wrong, but I've been able to replicate the error just in the example project.

In my app, this causes a crash, and in the example app it causes AudioService.runnning to return true, and AudioService.stop() to never complete (as it's awaiting super.onStop())

Minimal reproduction project
Provide a link here using one of two options:

I am using the example project. The problem occurs when the onStop() method is called.

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Run example project
  2. Click AudioPlayer
  3. Play Audio
  4. Stop Audio

Error messages

Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: 37

Expected behavior

Graceful shutdown.

Runtime Environment (please complete the following information if relevant):

  • Device: Google Pixel 3a
  • OS: Android 10

Flutter SDK version

[✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.5 19F101, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[!] Android Studio (version 4.0)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)
1 backlog bug

Most helpful comment

I'll track this issue on #225 . This issue was supposedly fixed in flutter in that it should no longer crash anymore (although the logs do still appear). If you are still getting a crash, that is concerning, and so it would be great if you could mention this on the other issue.

>All comments

I'll track this issue on #225 . This issue was supposedly fixed in flutter in that it should no longer crash anymore (although the logs do still appear). If you are still getting a crash, that is concerning, and so it would be great if you could mention this on the other issue.

Was this page helpful?
0 / 5 - 0 ratings