Closed KriRic closed 6 years ago
I have also suddenly developed this issue. Nothing in my code has changed, however this issue surfaced sometime last week without warning. I checked for any updates to the Android tablet I am using but there have not been any that might explain this. I have rebooted the tablet, deleted the app and cleaned all of the build files to no avail. I have also verified that my app still has the RECORD_AUDIO permission configured in AssemblyInfo.cs. Nothing seems to help. It only affects Android. Here are the relevant lines from the debug log:
10-10 10:34:47.586 E/mono (26061): Unhandled Exception:
10-10 10:34:47.586 E/mono (26061): System.Exception: Unable to successfully initialize AudioRecord; reporting State.Uninitialized. If using an emulator, make sure it has access to the system microphone.
10-10 10:34:47.586 E/mono (26061): at Plugin.AudioRecorder.AudioStream.init () [0x00044] in <aa280177c31b4c7585e5e500bd898f3f>:0
10-10 10:34:47.586 E/mono (26061): at Plugin.AudioRecorder.AudioStream.Start () [0x00056] in <aa280177c31b4c7585e5e500bd898f3f>:0
10-10 10:34:47.586 E/mono (26061): at Plugin.AudioRecorder.WaveRecorder+<StartRecorder>d__6.MoveNext () [0x001a2] in <aa280177c31b4c7585e5e500bd898f3f>:0
10-10 10:34:47.586 E/mono (26061): --- End of stack trace from previous location where exception was thrown ---
10-10 10:34:47.586 E/mono (26061): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
10-10 10:34:47.586 E/mono (26061): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
10-10 10:34:47.586 E/mono (26061): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
10-10 10:34:47.586 E/mono (26061): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
10-10 10:34:47.586 E/mono (26061): at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
10-10 10:34:47.586 E/mono (26061): at Plugin.AudioRecorder.AudioRecorderService+<StartRecording>d__43.MoveNext () [0x00088] in <aa280177c31b4c7585e5e500bd898f3f>:0
Well, I for one feel pretty dumb about now. Even though the RECORD_AUDIO permission was set in AssemblyInfo.cs, the actual permission wasn't being granted at runtime (running Nougat). I have added better code to handle the permissions request in my app.
@KriRic It may seem obvious, but have you checked the permissions of your app? Go to 'Settings -> Apps -> [APP NAME] -> Permissions' on your device and make sure that the Microphone permission (at least) is turned on.
@FlammableFork thanks for helping out. This is indeed typically why this error is thrown. I've also had running, functioning emulators magically and suddenly unable to access the mic until they're restarted.
I added some sample code in the readme showing how to check for the runtime permission. Apparently this was only needed for newer OS versions.
Hy, the plugin will be exactly what i need, but i have the followinf problem:
When i run the App with this simple code
i get the following error message: "System Exception: Unable to successfully initialize AudioRecord; reporting State.Uninitialized. If using an emulator make sure it has access to the system microphone."
I get this message independent whether i´m using the App in the VS emulator or directly on my phone. I can´t find any options to activate mic access in the emulator.
So what could be the reason for that?