I created a layout for my activity in Android Studio which consists of 4x Image Buttons and 5x TextViews.
I imported the PNG files for the Image Buttons and set the Image for each button.
I set the Text for the TextViews to the txet in the strings.xml
I set the Content for the Image Buttons to the text in the strings.xml
I set the constraints for all the components and ran the app and it worked fine.
I noticed that the background of the Image Buttons were grey, so I set them to transparent (@android:color/transparent)
I wanted a placeholder for ad space, so I added an AdView box, but then deleted it when it wouldn't compile due to missing XML parameters.
When I try to view the layout on the emulator it doesn't do anything. If I try to run it again I get a popup on the emulator that the app crashed.
There are no build errors or warnings. I have added ZERO code, so I am at a real loss of why a simple layout won't display.
Logcat and XML code below
In the logcat, it looks like the errors start about here. I have included them through the end of the log:
07-07 11:49:38.013 I/MicroRecognitionRunner( 6812): Starting detection.
07-07 11:49:38.013 I/MicrophoneInputStream( 6812): mic_starting SR : 16000 CC : 16 SO : 6
07-07 11:49:38.014 E/ ( 1658): Request requires android.permission.RECORD_AUDIO
07-07 11:49:38.014 E/AudioPolicyIntefaceImpl( 1658): getInputForAttr permission denied: recording not allowed for uid 10041 pid 6812
07-07 11:49:38.014 E/AudioFlinger( 1658): createRecord() checkRecordThread_l failed
07-07 11:49:38.014 E/IAudioFlinger( 6812): createRecord returned error -22
07-07 11:49:38.014 E/AudioRecord( 6812): AudioFlinger could not create record track, status: -22
07-07 11:49:38.015 E/AudioRecord-JNI( 6812): Error creating AudioRecord instance: initialization check failed with status -22.
07-07 11:49:38.015 E/android.media.AudioRecord( 6812): Error code -20 when initializing native AudioRecord object.
07-07 11:49:38.015 I/MicrophoneInputStream( 6812): mic_started SR : 16000 CC : 16 SO : 6
07-07 11:49:38.015 E/ActivityThread( 6812): Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
07-07 11:49:38.015 I/MicroDetectionWorker( 6812): onReady
07-07 11:49:38.017 I/MicrophoneInputStream( 6812): mic_close SR : 16000 CC : 16 SO : 6
07-07 11:49:38.017 I/MicroRecognitionRunner( 6812): Detection finished
07-07 11:49:38.017 W/ErrorReporter( 6812): reportError [type: 211, code: 524300]: Error reading from input stream
07-07 11:49:38.018 I/MicroRecognitionRunner( 6812): Stopping hotword detection.
07-07 11:49:38.019 W/ErrorProcessor( 6812): onFatalError, processing error from engine(4)
07-07 11:49:38.019 W/ErrorProcessor( 6812): com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.staticplugins.microdetection.d.k.a(SourceFile:91)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.staticplugins.microdetection.d.l.run(Unknown Source:14)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.libraries.gsa.runner.a.a.b(SourceFile:32)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.libraries.gsa.runner.a.c.call(Unknown Source:4)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.shared.util.concurrent.b.g.run(Unknown Source:4)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.lang.Thread.run(Thread.java:764)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.shared.util.concurrent.b.i.run(SourceFile:6)
07-07 11:49:38.019 W/ErrorProcessor( 6812): Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.speech.audio.Tee.j(SourceFile:103)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.io.InputStream.read(InputStream.java:101)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:17)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2)
07-07 11:49:38.019 W/ErrorProcessor( 6812): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
07-07 11:49:38.019 W/ErrorProcessor( 6812): ... 10 more
07-07 11:49:38.019 I/AudioController( 6812): internalShutdown
07-07 11:49:38.020 I/MicroDetector( 6812): Keeping mic open: false
07-07 11:49:38.020 I/MicroDetectionWorker( 6812): #onError(false)
07-07 11:49:38.021 I/DeviceStateChecker( 6812): DeviceStateChecker cancelled
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageButton
android:id="@+id/btnTakeOut"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_marginStart="50dp"
android:layout_marginTop="170dp"
android:background="@android:color/transparent"
android:contentDescription="@string/strTakeOutContent"
app:layout_constraintStart_toEndOf="@+id/btnFastFood"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/take_out_125x125" />
<ImageButton
android:id="@+id/btnFastFood"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_marginStart="56dp"
android:layout_marginTop="170dp"
android:background="@android:color/transparent"
android:contentDescription="@string/strFastFoodContent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/fast_food_125x125" />
<ImageButton
android:id="@+id/btnDineIn"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_marginStart="56dp"
android:layout_marginTop="50dp"
android:background="@android:color/transparent"
android:contentDescription="@string/strDineInContent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnFastFood"
app:srcCompat="@drawable/dine_in_125x125" />
<ImageButton
android:id="@+id/btnEatHome"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_marginStart="50dp"
android:layout_marginTop="50dp"
android:background="@android:color/transparent"
android:contentDescription="@string/strEatHomeContent"
app:layout_constraintStart_toEndOf="@+id/btnDineIn"
app:layout_constraintTop_toBottomOf="@+id/btnTakeOut"
app:srcCompat="@drawable/eatathome_125x125" />
<TextView
android:id="@+id/txvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginTop="75dp"
android:text="@string/strMainTitle"
android:textSize="36sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/txvFastFood"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="88dp"
android:layout_marginTop="5dp"
android:text="@string/strFastFood"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnFastFood" />
<TextView
android:id="@+id/txvTakeOut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="88dp"
android:layout_marginTop="5dp"
android:text="@string/strTakeOut"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnTakeOut" />
<TextView
android:id="@+id/txvDineIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="96dp"
android:layout_marginTop="5dp"
android:text="@string/strDineIn"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnDineIn" />
<TextView
android:id="@+id/txvEatHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="80dp"
android:layout_marginTop="5dp"
android:text="@string/strEatHome"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnEatHome" />
</androidx.constraintlayout.widget.ConstraintLayout>