App crashes at launch with the following error:
FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.raywenderlich.podplay/com.raywenderlich.podplay.PodcastActivity}: android.view.InflateException: Binary XML file line #22 in com.raywenderlich.podplay:layout/activity_podcast: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x7f030003 a=-1}, theme={InheritanceMap=[id=0x7f110269com.raywenderlich.podplay:style/Theme.PodPlay.AppBarOverlay, id=0x7f11026fcom.raywenderlich.podplay:style/ThemeOverlay.AppCompat.Dark.ActionBar, id=0x7f110075com.raywenderlich.podplay:style/Base.ThemeOverlay.AppCompat.Dark.ActionBar, id=0x7f110074com.raywenderlich.podplay:style/Base.ThemeOverlay.AppCompat.Dark, id=0x7f110137com.raywenderlich.podplay:style/Platform.ThemeOverlay.AppCompat.Dark, id=0x7f110136com.raywenderlich.podplay:style/Platform.ThemeOverlay.AppCompat], Themes=[com.raywenderlich.podplay:style/Theme.PodPlay.AppBarOverlay, forced, com.raywenderlich.podplay:style/Theme.PodPlay.NoActionBar, forced, com.raywenderlich.podplay:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
Theme.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.PodPlay" parent="android:ThemeOverlay.Material.Dark.ActionBar">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
</style>
<style name="Theme.PodPlay.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.PodPlay.AppBarOverlay"
parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="Theme.PodPlay.PopupOverlay"
parent="ThemeOverlay.AppCompat.Light"/>
</resources>
Part of activity_podcast.xml
file:
<?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="com.raywenderlich.podplay.PodcastActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:fitsSystemWindows="true"
android:theme="@style/Theme.PodPlay.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/Theme.PodPlay.PopupOverlay"/>. // This is line 22 referenced in the error
</com.google.android.material.appbar.AppBarLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.PodPlay"
tools:targetApi="31">
<activity
android:name=".PodcastActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/Theme.PodPlay.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
</application>
</manifest>
PodcastActivity.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityPodcastBinding.inflate(layoutInflater)
setContentView(binding.root)
}
What am I doing wrong?
Link to the project