Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6376105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:42:07+00:00 2026-05-25T01:42:07+00:00

My problem is simple to explain — I am trying to create a AudioRecord

  • 0

My problem is simple to explain — I am trying to create a AudioRecord object but it fails to initialize (ie after the constructor, getState returns 0, indicating failure). I am running this from Eclipse on a MotoDroid 1 running OS 2.2.1. My AndroidManifest.xml is, AFAIK, using the right permission, RECORD_AUDIO (I don’t know how to confirm this):

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <activity android:name=".SphinxMic"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

I do the following to create the AudioRecord:

bufferSize = AudioRecord.getMinBufferSize(8000, CHANNEL_IN_MONO, ENCODING_PCM_8BIT);
audioRecorder = new AudioRecord(AudioSource.MIC, 8000, CHANNEL_IN_MONO, ENCODING_PCM_8BIT, 50*bufferSize);
if (audioRecorder.getState() != AudioRecord.STATE_INITIALIZED)
  throw new Exception("AudioRecord init failed");

audioRecorder.getState() returns 0 (ie STATE_UNINITIALIZED)

I have not found any complete examples of using this API and I’m very much an Android beginner so the solution may well be something simple. What can I do to find out why it fails?

A few people have asked similar questions, but they must have been having different problems than me because the fixes they approve haven’t helped me. Most notably this. But the approved solution is perplexing and didn’t work for me anyway. I have also tried a variety of bit rates (8000, 16000, 11025, 44100), both mono and stereo and 8 and 16 bit. No combination comes back as successfully initialized.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:42:08+00:00Added an answer on May 25, 2026 at 1:42 am

    I spent some hours solving this problem, and found out that moving

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    

    outside the application block actually solved it!

    ...
        </application>
    
        <uses-permission android:name="android.permission.RECORD_AUDIO" /> 
    </manifest>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem is simple, but I'm struggling a bit already. Server server = new
a possibly simple problem, but weird why I have no idea how to do
somewhat simple problem(to explain) this time: i have an array of markers that i
I have this simple problem. I'll try to explain with a sample code An
to explain my problem, I'll give a simple example: My database has three tables:
This is a bit of a difficult problem to explain, but I'm hoping it
I hope to explain my problem simple in order to get good feedback :)
I want to create link_to google like in Rails. Let me explain. On simple
Pretty simple problem to explain: In Visual Studio 2010 SP1, I'm seeing weird indentation
Can anyone explain me why on that c++ simple code valgrind returns this .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.