Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidX - Layout Inflation Failing on dependency later than com.google.android.material:material:1.0.0 #772

Open
bradleyf opened this issue Jul 15, 2021 · 0 comments

Comments

@bradleyf
Copy link

bradleyf commented Jul 15, 2021

On AndroidX dependencies later than com.google.android.material:1.0.0 (e.g., 1.1, 1.2, 1.3, 1.4, etc) the layout inflater is crashing the Flexible Adapter:

java.lang.UnsupportedOperationException: Failed to resolve attribute at index 2: TypedValue{t=0x2/d=0x7f0400cd a=6}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:597)
at androidx.cardview.widget.CardView.(CardView.java:127)
at androidx.cardview.widget.CardView.(CardView.java:117)

Full Trace below:

/AndroidRuntime: FATAL EXCEPTION: main
Process: com.riotinsight.riotretail, PID: 26061
android.view.InflateException: Binary XML file line #18 in com.riotinsight.riotretail:layout/drilldown_item_header: Binary XML file line #18 in com.riotinsight.riotretail:layout/drilldown_item_header: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #18 in com.riotinsight.riotretail:layout/drilldown_item_header: Error inflating class
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:854)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at eu.davidea.flexibleadapter.FlexibleAdapter.onCreateViewHolder(FlexibleAdapter.java:1733)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7295)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6300)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6296)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1631)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4012)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:625)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1855)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at com.google.android.material.appbar.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:148)
at com.google.android.material.appbar.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:43)
at com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1996)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:918)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1231)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
E/AndroidRuntime: at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:779)
at android.view.View.layout(View.java:22470)
at android.view.ViewGroup.layout(ViewGroup.java:6309)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3172)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2617)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1748)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7789)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1041)
at android.view.Choreographer.doCallbacks(Choreographer.java:864)
at android.view.Choreographer.doFrame(Choreographer.java:798)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1026)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 2: TypedValue{t=0x2/d=0x7f0400cd a=6}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:597)
at androidx.cardview.widget.CardView.(CardView.java:127)
at androidx.cardview.widget.CardView.(CardView.java:117)
... 85 more

Layout Resource File:

<androidx.cardview.widget.CardView
    android:id="@+id/drillableBodyWrapper"
    style="@style/ExpandableListItemContentCard"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="8dp"
    android:layout_marginBottom="8dp"
    app:cardCornerRadius="8dp">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#000">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/contentWrapper"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginEnd="42dp"
            android:layout_marginRight="42dp"
            android:background="#000"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="@+id/actionContainer"
            app:layout_constraintHorizontal_bias="0.758"
            app:layout_constraintStart_toStartOf="@+id/actionContainer"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.0">

            <CheckBox
                android:id="@+id/checkBox"
                style="@style/RiotCheckableTileCheckbox"
                android:layout_marginTop="@dimen/size_0"
                android:layout_marginBottom="@dimen/size_0"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"

                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintVertical_bias="0.5" />

            <TextView
                android:id="@+id/title"
                style="@style/Riot.ListItemHeading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:layout_marginBottom="4dp"
                app:layout_constraintBottom_toTopOf="@+id/percentage_bar"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:text="Heading" />

            <TextView
                android:id="@+id/subtext"
                style="@style/Riot.ListItemDescription"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="4dp"
                android:layout_marginBottom="4dp"
                app:layout_constraintBottom_toTopOf="@+id/percentage_bar"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toEndOf="@+id/title"
                app:layout_constraintTop_toTopOf="parent"
                tools:text="description label" />

            <TextView
                android:id="@+id/count"
                style="@style/Riot.ListItemRatioLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginTop="4dp"
                android:layout_marginEnd="8dp"
                android:layout_marginBottom="4dp"
                app:layout_constraintBottom_toTopOf="@+id/percentage_bar"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="1.0"
                app:layout_constraintStart_toEndOf="@+id/subtext"
                app:layout_constraintTop_toTopOf="parent"
                tools:text="Total / Number" />

            <ProgressBar
                android:id="@+id/percentage_bar"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="0dp"
                android:layout_height="16dp"
                android:progress="35"
                android:progressDrawable="@drawable/custom_progressbar_no_radius"
                android:theme="@style/ProgressBarStyle"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintVertical_bias="1.0" />

            <TextView
                android:id="@+id/percentage"
                style="@style/Riot.ListItemProgressLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="@+id/percentage_bar"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="@+id/percentage_bar"
                app:layout_constraintTop_toTopOf="@+id/percentage_bar"
                tools:text="0%" />

        </androidx.constraintlayout.widget.ConstraintLayout>

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/actionContainer"
            android:layout_width="42.7dp"
            android:layout_height="0dp"
            android:background="#FFF"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/expansion_indicator"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="fitCenter"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintVertical_bias="0.50"
                app:srcCompat="@drawable/ic_chevron_down" />
        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
@bradleyf bradleyf changed the title AndroidX - Layout Inflation Failing on dependency later than com.google.android.material:material:1.1.0 AndroidX - Layout Inflation Failing on dependency later than com.google.android.material:material:1.0.0 Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant