title: AudioRecord can not be initialized
body: <p>I am trying to work with audiorecorder, but I am getting illegal argument exceptions stating that the audiorecorder is not initialised.</p>
  
  <p>My code is like the one shown <a href="http://code.google.com/p/krvarma-android-samples/source/browse/trunk/AudioRecorder.2/src/com/varma/samples/audiorecorder/RecorderActivity.java" rel="nofollow noreferrer">here</a></p>
  
  <pre><code>private static final int RECORDER_SAMPLERATE = 44100;
  private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_STEREO;
  private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
  
  recorder = new AudioRecord(MediaRecorder.AudioSource.MIC,RECORDER_SAMPLERATE,  RECORDER_CHANNELS,RECORDER_AUDIO_ENCODING, bufferSize);                        
  recorder.startRecording();
  </code></pre>
  
  <p>I have seen another answer which seems to work for some people but it isn't working for me 
  <a href="https://stackoverflow.com/questions/4843739/audiorecord-object-not-initializing">AudioRecord object not initializing</a></p>