I have FloatingActionButton
in my app. It is working fine in Android N and O . but it is crashing in Marshmallow. Can any one help me to solve this issue.
Error
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.widget.FloatingActionButton
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at LibraryFragment.onCreateView(LibraryFragment.java:69)
XML
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabChat"
android:backgroundTint="#114358"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="100dp"
android:layout_marginRight="16dp"
app:srcCompat="@drawable/language"
app:borderWidth="0dp"
app:elevation="4sp" />
build.gradle
compileSdkVersion 26
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.github.moondroid.coverflow:library:1.0'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.github.florent37:diagonallayout:1.0.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
Maybe it's because of the version you are using with Android design library:
Paste this inside dependencies, if it is already there then replace it
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
Also change compileSdkVersion to 25
Also change:
android:backgroundTint="#114358"
with app:backgroundTint="#114358"
And if you are using vector asset as src then use
app:srcCompat="@drawable/you_graphics"
Insted of this
android:src="@drawable/your_graphics"
Hope it helps