Error inflating class com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton

From your logcat

Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).

So add a material theme for your app/current activity will fix this issue

1) add dependency* (latest / more stable version)

implementation 'com.google.android.material:material:1.2.0-alpha01'

2) Create a new theme

<style name="MyMaterialTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <!-- Add attributes here -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="textAppearanceButton">@style/AppTextAppearance.Button</item>
</style>
 <!--To fix rendering in preview -->
 <style name="AppTextAppearance.Button" parent="TextAppearance.MaterialComponents.Button">
    <item name="android:textAllCaps">true</item>
</style>

change parent material theme according to you parent="Theme.MaterialComponents.*

3) change app theme or current activity theme in manifest

android:theme="@style/MyMaterialTheme"

or

<activity android:name=".MyActivity" android:theme="@style/MyMaterialTheme"> </activity>

4) If you found any rendering issue in previews, adding themes to ExtendedFloatingActionButton will fix this

Failed to find '@attr/textAppearanceButton' in current theme.

add theme to ExtendedFloatingActionButton android:theme="@style/MyMaterialTheme"

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:theme="@style/MyMaterialTheme"
        android:text="ExtendedFab"            
        app:icon="@drawable/ic_add_a_photo_white_24dp"
       />

For more info visit Material Design Page


You need to use a an app or activity theme that is a descendant from Theme.MaterialComponents.

You can see in the trace: Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).