I've found several answers (like this one) that tell it is possible to record audio in Android Emulator. But I didn't succeed in finding any suitable setting in Android Virtual Device Manager and I still get an exception on the line
In the documentation of
MediaRecorder you can see that:
Note: Currently, MediaRecorder does not work on the emulator.
Even in the last API.
But I saw that in the class
AudioRecord, there is no note for this.
More then that, I have found this code:
AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, 500000); recorder.startRecording();
From here. And the code's author said that this code works in the emulator.