1

I have a recycler view where each element has an image. Sometimes this is blank, sometimes this has a placeholder, sometimes this has an image retrieved via Picasso. Works perfectly fine in simulators and on two devices running Marshmallow. Not working at all on two devices on 4.3 and 4.4.2 respectively (a Samsung S3 and Galaxy Tab 3 8.0). I get the following error:

android.view.InflateException: Binary XML file line #103: Error inflating class ImageView
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                                                                      at com.rhls.directrepairs.AgentListViewAdapter.onCreateViewHolder(AgentListViewAdapter.java:43)
                                                                      at com.rhls.directrepairs.AgentListViewAdapter.onCreateViewHolder(AgentListViewAdapter.java:20)
                                                                      at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5779)
                                                                      at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5003)
                                                                      at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4913)
                                                                      at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2029)
                                                                      at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1414)
                                                                      at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377)
                                                                      at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578)
                                                                      at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3260)
                                                                      at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3069)
                                                                      at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3518)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
                                                                      at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
                                                                      at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1319)
                                                                      at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:817)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
                                                                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
                                                                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
                                                                      at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
                                                                      at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
                                                                      at android.view.View.layout(View.java:15204)
                                                                      at android.view.ViewGroup.layout(ViewGroup.java:4793)
                                                                      at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2260)
                                                                      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2007)
                                                                      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
                                                                      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
                                                                      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
                                                                      at android.view.Choreographer.doCallbacks(Choreographer.java:591)
                                                                      at android.view.Choreographer.doFrame(Choreographer.java:561)
                                                                      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
                                                                      at android.os.Handler.handleCallback(Handler.java:730)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:92)
                                                                    at android.os.Loope

I am currently unable to make this work. I have tried removing the placeholder image (a drawable .png file) from the src field in the XML, but still get the crash. Any ideas as to why this isn't working?

markeh21
  • 189
  • 12
  • Can we see layout xml code? – pRaNaY Sep 03 '16 at 18:02
  • 1
    There should be more stanzas to the stack trace, with "Caused by" sections outlining nested exceptions. Those should give you more information about the root cause, such as an `OutOfMemoryError`. – CommonsWare Sep 03 '16 at 18:05
  • There was no other information present on the stack trace, it cut short at the bottom as you can see - However when pasting the xml, I noticed it using a system drawable (an arrow to signify that the row was clickable) that I can only assume was not present in older versions or was otherwise wrong - changed that out for another icon and works perfectly – markeh21 Sep 03 '16 at 18:40
  • whats @ at `com.rhls.directrepairs.AgentListViewAdapter.onCreateViewHolder(AgentListViewAdapter.java:43)` and `com.rhls.directrepairs.AgentListViewAdapter.onCreateViewHolder(AgentListViewAdapter.java:20)` – TWL Sep 03 '16 at 20:09

1 Answers1

0

It's maybe because you are using vectors as background in your ImageView Take a look at this answer

Fakher
  • 2,098
  • 3
  • 29
  • 45