Error inflating anything from the design support library
xml
<android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content"/>
build.gradle
dependencies { compile 'com.android.support:support-v4:22.2.0' compile 'com.android.support:design:22.2.0' compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:support-v13:22.2.0' compile 'com.android.support:appcompat-v7:22.2.0'
project build.gradle
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } allprojects { repositories { mavenCentral() } }
Error:
Binary XML file line #115: Error inflating class android.support.design.widget.FloatingActionButton
My Sdk Manager everything is up to date.
The Design Support library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and tabs. The Gradle build script dependency identifier for this library is as follows: com. android.
The AndroidX library contains the existing support library and also includes the latest Jetpack components. You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android. support.
In addition to Emmanuel's answer you could be facing the following problem.
It seems like the design library components need a style which is based on an AppCompat Theme. So try to use "Theme.AppCompat.[...]" as a parent in your style.xml.
Example:
<!-- Base application theme. --> <style name="AppTheme" parent="Base.AppTheme"> <!-- Customize your theme here. --> </style> <style name="Base.AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:colorPrimary">@color/primary</item> <item name="android:colorPrimaryDark">@color/primary_dark</item> <item name="android:colorAccent">@color/accent</item> </style>
Then add the following to your build.gradle as well:
compile 'com.android.support:appcompat-v7:22.2.0'
Additionally you should update the following lines in your gradle as well:
classpath 'com.android.tools.build:gradle:1.2.3' compileSdkVersion 22 buildToolsVersion '22.0.1' targetSdkVersion 22
Update Support Library on SDK Manager in Extras > Android Support Repository and Android Support Library, that works for me ;)
and dont forget to add the compile 'com.android.support:design:22.2.0' on app.gradle and sync
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With