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.

Bug on Android when startRecorder called

See original GitHub issue

Version of flutter_sound

1.2.4

flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.1 18B75, locale en-CA) [✓] Android toolchain - develop for Android devices (Android SDK 28.0.3) [✓] iOS toolchain - develop for iOS devices (Xcode 10.1) [✓] Android Studio (version 3.2) [✓] Connected device (1 available) • No issues found!

Platforms you faced the error (IOS or Android or both?)

This Error accurs on Android.

Expected behavior

Expected behavior is it would start recording audio

Actual behavior

Error Shows with this:

E/MethodChannel#flutter_sound(13084): Failed to handle method call E/MethodChannel#flutter_sound(13084): java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer E/MethodChannel#flutter_sound(13084): at com.dooboolab.fluttersound.FlutterSoundPlugin.onMethodCall(FlutterSoundPlugin.java:62) E/MethodChannel#flutter_sound(13084): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200) E/MethodChannel#flutter_sound(13084): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163) E/MethodChannel#flutter_sound(13084): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#flutter_sound(13084): at android.os.MessageQueue.next(MessageQueue.java:326) E/MethodChannel#flutter_sound(13084): at android.os.Looper.loop(Looper.java:160) E/MethodChannel#flutter_sound(13084): at android.app.ActivityThread.main(ActivityThread.java:6669) E/MethodChannel#flutter_sound(13084): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#flutter_sound(13084): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/MethodChannel#flutter_sound(13084): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) E/flutter (13084): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception: E/flutter (13084): Exception: PlatformException(error, java.lang.Double cannot be cast to java.lang.Integer, null) E/flutter (13084): #0 FlutterSound.startRecorder (package:flutter_sound/flutter_sound.dart:102:7) E/flutter (13084): <asynchronous suspension> E/flutter (13084): #1 _RecordingPageState._onRecordPressed (package:speechdb/ui/recording_page.dart:217:35) E/flutter (13084): <asynchronous suspension> E/flutter (13084): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14) E/flutter (13084): #3 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:562:30) E/flutter (13084): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24) E/flutter (13084): #5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9) E/flutter (13084): #6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7) E/flutter (13084): #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9) E/flutter (13084): #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12) E/flutter (13084): #9 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11) E/flutter (13084): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:180:19) E/flutter (13084): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22) E/flutter (13084): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7) E/flutter (13084): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7) E/flutter (13084): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7) E/flutter (13084): #15 _invoke1 (dart:ui/hooks.dart:168:13) E/flutter (13084): #16 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5)

Tested environment (Emulator? Real Device?)

Emulator and Real Device

Steps to reproduce the behavior

When I call: path = await flutterSound.startRecorder(filename);

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
haideraltahancommented, Jan 22, 2019

I think I found the problem under flutter_sound/android/src/main/java/com/dooboolab/fluttersound/AudioInterface.java int sampleRate needs to be double rather than int.

Or in flutter_sound/lib/flutter_sound.dart change double sampleRate = 44100.0 to int sampleRate = 44100

0reactions
Larpouxcommented, Jun 4, 2020

Please fill a new issue with all the informations needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caused by: java.lang.IllegalStateException: startRecording ...
I am getting error like start recording() called ...
Read more >
[Android 2.0+] Audio Bug - Voice Recorder | XDA Forums
Audio Bug is an easy-to-use high quality audio/voice recorder. It stands out in its ways to start a recording. You could take your...
Read more >
TvRecordingClient - Android Developers
To continue recording, please call TvRecordingClient#resumeRecording() to resume instead of TvRecordingClient#startRecording(Uri) . Application can stop the ...
Read more >
AudioRecord.OnRecordPositionUpdateListener
I don't know if this is a bug in Android or in the documentation but either ... callback on API 16, 17, 18...
Read more >
Diff - 42419ce^! - platform/frameworks/base - Git at Google
The recorder calls ICameraRecordingProxy::startRecording() and passes a ... MediaRecorder} is - * done recording if {@link android.media.
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