I catch

java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord. 

when trying to record an audio file

 int RECORDER_BUFFER_SIZE = AudioRecord.getMinBufferSize(AUDIO_RATE, CHANNEL, FORMAT) * BUFFER_SCALE; int AUDIO_RATE = 11025; int CHANNEL = AudioFormat.CHANNEL_IN_STEREO; int FORMAT = AudioFormat.ENCODING_PCM_16BIT; byte[] buffer = new byte[RECORDER_BUFFER_SIZE]; recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, AUDIO_RATE, CHANNEL, FORMAT, RECORDER_BUFFER_SIZE * DELAY); //start record voice recorder.startRecording(); 

I catch this error on the Nexus 5 device (firmware 6.0.1), and on Nexus 4 and Nexus 7 with firmware (5.0.1) everything works fine!

  • Look here and here - YuriySPb
  • @ YuriySPb did not help ( - Kirill Stoianov

0