flutter_sound
flutter_sound copied to clipboard
[BUG]: java.lang.IllegalStateException: Reply already submitted
Hello, I got this exception when reloading the app:
Are you stopping the player/recorder and closing the audio session during a dispose method? That should fix problems with hot reloads
Yes, check that please
i have the same problem. I only use FlutterSoundRecorder and close session in dispose.
Is it possible to have logs ?
I am running into the same issue. It seems to be Android-specific, it works fine on iOS. Here are the related logs :
I/flutter (19698): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (19698): │ #0 FlutterSoundRecorder.openAudioSession (package:flutter_sound/public/flutter_sound_recorder.dart:393:13)
I/flutter (19698): │ #1 _ConversationPageState.build.<anonymous closure>.<anonymous closure> (package:[REDACTED])
I/flutter (19698): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (19698): │ 🐛 FS:---> openAudioSession
I/flutter (19698): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
W/IInputConnectionWrapper(19698): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(19698): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(19698): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(19698): endBatchEdit on inactive InputConnection
I/flutter (19698): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (19698): │ #0 FlutterSoundRecorder._openAudioSession (package:flutter_sound/public/flutter_sound_recorder.dart:413:13)
I/flutter (19698): │ #1 FlutterSoundRecorder.openAudioSession.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:395:17)
I/flutter (19698): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (19698): │ 🐛 ---> openAudioSession
I/flutter (19698): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (19698): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (19698): │ #0 FlutterSoundRecorder._openAudioSession (package:flutter_sound/public/flutter_sound_recorder.dart:428:17)
I/flutter (19698): │ #1 FlutterSoundRecorder.openAudioSession.<anonymous closure> (package:flutter_sound/public/flutter_sound_recorder.dart:395:17)
I/flutter (19698): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (19698): │ 🐛 Resetting flutter_sound Recorder Plugin
I/flutter (19698): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): Failed to handle method call
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at com.dooboolab.fluttersound.FlutterSoundManager.resetPlugin(FlutterSoundManager.java:88)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at com.dooboolab.fluttersound.FlutterSoundRecorderManager.onMethodCall(FlutterSoundRecorderManager.java:70)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at android.os.MessageQueue.next(Unknown Source:17)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at android.os.Looper.loopOnce(Unknown Source:6)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at android.os.Looper.loop(Unknown Source:77)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at android.app.ActivityThread.main(Unknown Source:138)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(19698): at com.android.internal.os.ZygoteInit.main(Unknown Source:306)
E/DartMessenger(19698): Uncaught exception in binary message listener
E/DartMessenger(19698): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(19698): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:155)
E/DartMessenger(19698): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:253)
E/DartMessenger(19698): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/DartMessenger(19698): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/DartMessenger(19698): at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(19698): at android.os.MessageQueue.next(Unknown Source:17)
E/DartMessenger(19698): at android.os.Looper.loopOnce(Unknown Source:6)
E/DartMessenger(19698): at android.os.Looper.loop(Unknown Source:77)
E/DartMessenger(19698): at android.app.ActivityThread.main(Unknown Source:138)
E/DartMessenger(19698): at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(19698): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(Unknown Source:11)
E/DartMessenger(19698): at com.android.internal.os.ZygoteInit.main(Unknown Source:306)
Do you try to do a hot restart and then get this bug? Do you have several isolate? Do you try to run flutter sound side by side with another audio plugin?
The crash seems to occur when we reset the android code. The reset procedure is a hack used to turn around another crash we have when doing hot restart. I am not surprised that this hack gives problems some time.
I would like to remove this patch. But someone must do something better to fix the hot restart crash
Do you try to do a hot restart and then get this bug? => Yes
Do you have several isolate? => No
Do you try to run flutter sound side by side with another audio plugin? => No, but we use SystemSound
somewhere else in the app
The result from .stopRecorder()
is always an empty String
, even on first try (without hot restart), but maybe that's another issue.
I also encountered this problem
flutter_sound: 8.4.2
`$ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.18363.592], locale zh-CN) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Chrome - develop for the web [√] Android Studio (version 4.2) [√] Connected device (3 available)
• No issues found!`
final FlutterSoundPlayer _mPlayer = FlutterSoundPlayer(logLevel: Level.nothing); await _mPlayer.openAudioSession(); await _mPlayer.startPlayer( fromURI: path, whenFinished: (){}, );
E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): Failed to handle method call E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): java.lang.IllegalStateException: Reply already submitted E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:164) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at com.dooboolab.fluttersound.FlutterSoundManager.resetPlugin(FlutterSoundManager.java:88) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at com.dooboolab.fluttersound.FlutterSoundPlayerManager.onMethodCall(FlutterSoundPlayerManager.java:66) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at android.os.MessageQueue.next(MessageQueue.java:335) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at android.os.Looper.loop(Looper.java:183) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at android.app.ActivityThread.main(ActivityThread.java:7656) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/MethodChannel#com.dooboolab.flutter_sound_player( 3348): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/DartMessenger( 3348): Uncaught exception in binary message listener E/DartMessenger( 3348): java.lang.IllegalStateException: Reply already submitted E/DartMessenger( 3348): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:164) E/DartMessenger( 3348): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:253) E/DartMessenger( 3348): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84) E/DartMessenger( 3348): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865) E/DartMessenger( 3348): at android.os.MessageQueue.nativePollOnce(Native Method) E/DartMessenger( 3348): at android.os.MessageQueue.next(MessageQueue.java:335) E/DartMessenger( 3348): at android.os.Looper.loop(Looper.java:183) E/DartMessenger( 3348): at android.app.ActivityThread.main(ActivityThread.java:7656) E/DartMessenger( 3348): at java.lang.reflect.Method.invoke(Native Method) E/DartMessenger( 3348): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/DartMessenger( 3348): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Same issue. flutter_sound: 9.2.13. Only happens after a hot restart. It seems just a warning, although shows as an exception. However, seems no affection, just annoying.
#938 I've made a solution @Larpoux
This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.