mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

UnsupportedOperationException when inflating v8.1.5 #2647

Closed RumataEstorish closed 4 years ago

RumataEstorish commented 4 years ago

Hi, Mike!

About this issue

When inflating drawer, app crashes

Details

Used libraries:

    implementation "com.mikepenz:materialdrawer-iconics:8.1.5"
    implementation 'com.mikepenz:materialdrawer:8.1.5'
    implementation 'com.mikepenz:google-material-typeface:3.0.1.0.original@aar'
    implementation 'com.mikepenz:fontawesome-typeface:5.3.1.2-kotlin@aar'
    implementation 'com.mikepenz:octicons-typeface:3.2.0.6-kotlin@aar'

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation "androidx.constraintlayout:constraintlayout:2.0.1"
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.annotation:annotation:1.1.0'

Layout:

<androidx.drawerlayout.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/samsung_background_color"
        android:orientation="vertical">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/Toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:title="@string/app_name" />

        <me.zhanghai.android.materialprogressbar.MaterialProgressBar
            android:id="@+id/updateProgress"
            style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:indeterminate="true"
            app:layout_constraintTop_toBottomOf="@+id/toolbar"
            app:mpb_progressStyle="horizontal" />

        <FrameLayout
            android:id="@+id/fragmentLayout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/updateProgress" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView
        android:id="@+id/drawer"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true" />
</androidx.drawerlayout.widget.DrawerLayout>

Error:

     Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 0: TypedValue{t=0x2/d=0x7f0400d0 a=2}
        at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:946)
        at android.content.res.TypedArray.getDrawable(TypedArray.java:930)

 E/AndroidRuntime:     at com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView.<init>(MaterialDrawerSliderView.kt:399)
        at com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView.<init>(MaterialDrawerSliderView.kt:49)
        at com.mikepenz.materialdrawer.widget.MaterialDrawerSliderView.<init>(Unknown Source:6)
            ... 28 more
mikepenz commented 4 years ago

@RumataEstorish sounds like you are not using the right theme for your activity

RumataEstorish commented 4 years ago

Thank you! My bad.