-4

I have been developing a simple app in android studio, but my app keeps crashing when i attempt to run it. The stacktrace:

03-29 23:32:34.720 2130-2206/com.google.android.googlequicksearchbox:search 
E/AudioRecord: Could not get audio input for session 4801, record source 
1999, sample rate 16000, format 0x1, channel mask 0x10, flags 0
03-29 23:32:34.720 2130-2206/com.google.android.googlequicksearchbox:search 
E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check 
failed with status -22.
03-29 23:32:34.720 2130-2206/com.google.android.googlequicksearchbox:search 
E/android.media.AudioRecord: Error code -20 when initializing native 
AudioRecord object.
03-29 23:32:34.721 2130-2206/com.google.android.googlequicksearchbox:search 
E/ActivityThread: Failed to find provider info for 
com.google.android.apps.gsa.testing.ui.audio.recorded

: onFatalError, processing error from engine(4)
com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
at java.io.InputStream.read(InputStream.java:101)
at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at java.lang.Thread.run(Thread.java:761) 
at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85) 

I don't understand why this is happening, I never attempt to use a microphone or anything audio related in my app.

Here is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nick.project2" >

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <activity android:name=".MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

When debugging my MainActivity.java, this is the block of code that crashes:

    public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    getFragmentManager().beginTransaction().add(R.id.professorContainer, myTeacher).commit();

    //Check to see if we should get the layout for a phone or a tablet
    if(findViewById(R.id.professorContainer) != null){
        //
        getFragmentManager().beginTransaction().add(R.id.professorContainer, myTeacher);
    }


}

It crashes at the third line in the onCreate method, "getFragmentManager()...."

USER9561
  • 1,084
  • 3
  • 15
  • 41
Nick
  • 11
  • 1
  • 3
  • 1
    Show your code and line at where is it crashing? – Piyush Mar 30 '17 at 04:26
  • 3
    You should probably try looking at the logs when its running, if its saying your app has stopped then there should be a crash stacktrace that you can analyze to figure out what is going on. – JoxTraex Mar 30 '17 at 04:26
  • These errors you gave are unrelated to your app – OneCricketeer Mar 30 '17 at 04:47
  • @cricket_007 how are they unrelated to my app if they are crashing my app?? – Nick Mar 30 '17 at 04:51
  • @Nick your app maybe crashing but that has nothing to do with what you've posted above unless you are developing for Google – Nilabja Mar 30 '17 at 04:54
  • You'd be seeing `com.example.nick.project2` in the errors if it was your code causing the errors... So filter the logcat on your package name – OneCricketeer Mar 30 '17 at 04:56
  • @Nilabja What i have posted above is the only information I have as to why my app is crashing. Nowhere else in my app do I have errors. The question is, why do I receive these errors if they have nothing to do with my app? @cricket_007 `com.example.nick.project2` does not appear at all in the logcat – Nick Mar 30 '17 at 04:56
  • check this http://stackoverflow.com/a/40465399/3879847 – Ranjithkumar Mar 30 '17 at 05:32

1 Answers1

1

I'm guessing you may have some quicksearch widget in your layout. Quicksearch uses Google Speech recognition API which needs Audio record permission. Add that permission.

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