title: <AudioRecord> Could not get audio input for record source 1
body: <p>I am trying to get AudioRecord instance but I get errors: </p>
  
  <blockquote>
    <p>Could not get audio input for record source 1</p>
    
    <p>Error creating AudioRecord instance: initialization check failed.</p>
    
    <p>Error code -20 when initializing native AudioRecord object.</p>
  </blockquote>
  
  <p>Here is my sample code: </p>
  
  <pre><code>public class AudioCapturer {
      AudioRecord recorder;
      private int channelConfig = AudioFormat.CHANNEL_IN_STEREO;
      private int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
      private static final int AUDIO_SAMPLE_RATE = 8000;
      private static int[] mSampleRates = new int[] { 8000, 11025, 22050, 44100 };
      int bufferSize = AudioRecord.getMinBufferSize(mSampleRates[3], channelConfig, audioFormat);
  
  
      protected void Start() {
          new Thread(new Runnable() {
                  public void run() {
                      recorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, mSampleRates[3], channelConfig, audioFormat, bufferSize);
                      Log.v("RECORDER","" +recorder.getState());
                      recorder.startRecording();
  
                      while(recorder.getRecordingState() == AudioRecord.RECORDSTATE_RECORDING)
                      {
                          byte [] buffer = new byte[bufferSize];
                          Log.v("READ RESULT","" + recorder.read(buffer, 0, buffer.length));
                      }
                  }
              }).start();
      }
  }
  </code></pre>
  
  <p>I've added permissions but result is still the same.<br>
  My mobile phone API version is 18.</p>