I am getting error like start recording() called uninitialized audio recording in android 2.3.4 version mobile(LG),its working fine in android 2.2 but throwing error in android 2.3.
-
Post ur code with logcat messages. – Randroid Aug 16 '12 at 08:32
-
i am trying post my code but i am getting error all ways from stack overflow – sravanthi Aug 16 '12 at 09:19
-
Caused by: java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord. – sravanthi Aug 16 '12 at 09:28
-
i am using audio recorder for recording audio from mic and i write the audio recording function in side of doinbackground() of asyntask() – sravanthi Aug 16 '12 at 09:33
-
In my main activity i am calling the my asynctask. – sravanthi Aug 16 '12 at 09:34
2 Answers
Also, make sure that you have this permission set in your AndroidManifest.xml:
<uses-permission android:name="android.permission.RECORD_AUDIO" />

- 3,976
- 1
- 34
- 40
-
3This needs to be outside the ```application``` but within the ```manifest``` block to work. – Adamski Nov 12 '14 at 21:31
-
You'd hope Google could mention this in the error! Instead we find ourselves testing the state, finding it is 'initialized', calling startRecording on the object and getting an error that says it's not initialized. – Andrew G Jan 25 '15 at 14:16
I am answering this question too late. May be my answer help other developers in future. Since Android 6.0 Marshmallow, application will not be granted any permission at installation time. Application has to ask user for a permission at run time. Permission request dialog will not launch automatically developer has to call for it manually after checking if permissions are given or not. In above case developer has to ask for android.permission.RECORD_AUDIO permission at run time. And also for android.permission.WRITE_EXTERNAL_STORAGE if saving recording to external storage. Also add to manifest as
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--Audio Record Permission-->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Hope it will help some dev out.

- 12,515
- 6
- 21
- 30