When I try to inflate layout this error comes
2022-07-23 14:49:59.117 15628-15628/com.codewithritom.anonchat E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.codewithritom.anonchat, PID: 15628
android.view.InflateException: Binary XML file line #8 in com.codewithritom.anonchat:layout/searched_user_item: Binary XML file line #8 in com.codewithritom.anonchat:layout/searched_user_item: Error inflating class io.getstream.avatarview.AvatarView
Caused by: android.view.InflateException: Binary XML file line #8 in com.codewithritom.anonchat:layout/searched_user_item: Error inflating class io.getstream.avatarview.AvatarView
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:863)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1019)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:970)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1149)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1110)
at android.view.LayoutInflater.inflate(LayoutInflater.java:692)
at android.view.LayoutInflater.inflate(LayoutInflater.java:542)
at com.codewithritom.anonchat.models.SearchedUsersAdapter.onCreateViewHolder(SearchedUsersAdapter.kt:25)
at com.codewithritom.anonchat.models.SearchedUsersAdapter.onCreateViewHolder(SearchedUsersAdapter.kt:19)
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:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1841)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1841)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
2022-07-23 14:49:59.118 15628-15628/com.codewithritom.anonchat E/AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
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:867)
at android.view.View.layout(View.java:23488)
at android.view.ViewGroup.layout(ViewGroup.java:6575)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:4119)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3495)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2416)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9478)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1242)
at android.view.Choreographer.doCallbacks(Choreographer.java:996)
at android.view.ChoreographerExtImpl.checkScrollOptSceneEnable(ChoreographerExtImpl.java:383)
at android.view.Choreographer.doFrame(Choreographer.java:865)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1227)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8248)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)
Caused by: android.content.res.Resources$NotFoundException: Can't find ColorStateList from drawable resource ID #0x7f0700b2
at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:1161)
at android.content.res.Resources.loadColorStateList(Resources.java:1158)
at android.content.res.TypedArray.getColor(TypedArray.java:521)
at io.getstream.avatarview.AvatarView.initAttributes(AvatarView.kt:170)
at io.getstream.avatarview.AvatarView.(AvatarView.kt:160)
at io.getstream.avatarview.AvatarView.(AvatarView.kt:55)
at io.getstream.avatarview.AvatarView.(Unknown Source:11)
... 74 more
2022-07-23 14:49:59.298 16459-16459/? E/hritom.anoncha: Unknown bits set in runtime_flags: 0x40000000
2022-07-23 14:49:59.740 16459-16494/com.codewithritom.anonchat E/QT: [QT]file does not exist
2022-07-23 14:49:59.878 16459-16459/com.codewithritom.anonchat E/OplusCustomizeRestrictionManager: sInstance is null, start a new sInstance
2022-07-23 14:50:00.049 16459-16459/com.codewithritom.anonchat E/hritom.anoncha: ofbOpen failed with error=No such file or directory
2022-07-23 14:50:00.049 16459-16459/com.codewithritom.anonchat E/hritom.anoncha: sysOpen failed with error=No such file or directory
2022-07-23 14:50:00.301 16459-16492/com.codewithritom.anonchat E/OpenGLRenderer: Device claims wide gamut support, cannot find matching config, error = EGL_SUCCESS
2022-07-23 14:50:00.314 16459-16520/com.codewithritom.anonchat E/ion: ioctl c0044901 failed with code -1: Invalid argument
2022-07-23 14:50:00.360 16459-16492/com.codewithritom.anonchat E/OpenGLRenderer: fbcNotifyFrameComplete error: undefined symbol: fbcNotifyFrameComplete
2022-07-23 14:50:00.360 16459-16492/com.codewithritom.anonchat E/OpenGLRenderer: fbcNotifyNoRender error: undefined symbol: fbcNotifyNoRender
2022-07-23 14:50:00.387 16459-16459/com.codewithritom.anonchat E/Parcel: Reading a NULL string not supported here.
Hey @RitomG69, the error you filed looks like an inflation error rather than the RecyclerView issue.
Could you try to build again with a static color for the avatarViewBorderColor attribute? Thanks!
Using avatarview in recycler adapter doesn't work
When I try to inflate layout this error comes 2022-07-23 14:49:59.117 15628-15628/com.codewithritom.anonchat E/AndroidRuntime: FATAL EXCEPTION: main Process: com.codewithritom.anonchat, PID: 15628 android.view.InflateException: Binary XML file line #8 in com.codewithritom.anonchat:layout/searched_user_item: Binary XML file line #8 in com.codewithritom.anonchat:layout/searched_user_item: Error inflating class io.getstream.avatarview.AvatarView Caused by: android.view.InflateException: Binary XML file line #8 in com.codewithritom.anonchat:layout/searched_user_item: Error inflating class io.getstream.avatarview.AvatarView 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:863) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1019) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:970) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1149) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1110) at android.view.LayoutInflater.inflate(LayoutInflater.java:692) at android.view.LayoutInflater.inflate(LayoutInflater.java:542) at com.codewithritom.anonchat.models.SearchedUsersAdapter.onCreateViewHolder(SearchedUsersAdapter.kt:25) at com.codewithritom.anonchat.models.SearchedUsersAdapter.onCreateViewHolder(SearchedUsersAdapter.kt:19) 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:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1103) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1841) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1841) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) 2022-07-23 14:49:59.118 15628-15628/com.codewithritom.anonchat E/AndroidRuntime: at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) 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:867) at android.view.View.layout(View.java:23488) at android.view.ViewGroup.layout(ViewGroup.java:6575) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:4119) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3495) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2416) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9478) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1242) at android.view.Choreographer.doCallbacks(Choreographer.java:996) at android.view.ChoreographerExtImpl.checkScrollOptSceneEnable(ChoreographerExtImpl.java:383) at android.view.Choreographer.doFrame(Choreographer.java:865) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1227) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:344) at android.app.ActivityThread.main(ActivityThread.java:8248) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071) Caused by: android.content.res.Resources$NotFoundException: Can't find ColorStateList from drawable resource ID #0x7f0700b2 at android.content.res.ResourcesImpl.loadColorStateList(ResourcesImpl.java:1161) at android.content.res.Resources.loadColorStateList(Resources.java:1158) at android.content.res.TypedArray.getColor(TypedArray.java:521) at io.getstream.avatarview.AvatarView.initAttributes(AvatarView.kt:170) at io.getstream.avatarview.AvatarView.(AvatarView.kt:160)
at io.getstream.avatarview.AvatarView.(AvatarView.kt:55)
at io.getstream.avatarview.AvatarView.(Unknown Source:11)
... 74 more
2022-07-23 14:49:59.298 16459-16459/? E/hritom.anoncha: Unknown bits set in runtime_flags: 0x40000000
2022-07-23 14:49:59.740 16459-16494/com.codewithritom.anonchat E/QT: [QT]file does not exist
2022-07-23 14:49:59.878 16459-16459/com.codewithritom.anonchat E/OplusCustomizeRestrictionManager: sInstance is null, start a new sInstance
2022-07-23 14:50:00.049 16459-16459/com.codewithritom.anonchat E/hritom.anoncha: ofbOpen failed with error=No such file or directory
2022-07-23 14:50:00.049 16459-16459/com.codewithritom.anonchat E/hritom.anoncha: sysOpen failed with error=No such file or directory
2022-07-23 14:50:00.301 16459-16492/com.codewithritom.anonchat E/OpenGLRenderer: Device claims wide gamut support, cannot find matching config, error = EGL_SUCCESS
2022-07-23 14:50:00.314 16459-16520/com.codewithritom.anonchat E/ion: ioctl c0044901 failed with code -1: Invalid argument
2022-07-23 14:50:00.360 16459-16492/com.codewithritom.anonchat E/OpenGLRenderer: fbcNotifyFrameComplete error: undefined symbol: fbcNotifyFrameComplete
2022-07-23 14:50:00.360 16459-16492/com.codewithritom.anonchat E/OpenGLRenderer: fbcNotifyNoRender error: undefined symbol: fbcNotifyNoRender
2022-07-23 14:50:00.387 16459-16459/com.codewithritom.anonchat E/Parcel: Reading a NULL string not supported here.
XML
<io.getstream.avatarview.AvatarView android:id = "@+id/profile_image" android:layout_width="110dp" android:layout_height="110dp" app:avatarViewBorderColor="@drawable/color_4" app:avatarViewBorderWidth="3dp" app:avatarViewIndicatorBorderColor="@color/white" app:avatarViewIndicatorBorderSizeCriteria="10" app:avatarViewIndicatorColor="@color/black" app:avatarViewIndicatorEnabled="true" app:avatarViewIndicatorPosition="bottomRight" app:avatarViewIndicatorSizeCriteria="9" app:avatarViewInitialsTextStyle="bold" app:avatarViewShape="circle" />
line 25 -
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view: View = LayoutInflater.from(mcontext).inflate(R.layout.searched_user_item, parent, false) return ViewHolder(view) }