2

While trying to generate a signed APK for release. I found the following error.

enter image description here

This error occurred only after I updated my Android Studio to 4.1.3.

enter image description here

On inspection, I found that recyclerView.setHasFixedSize(true) if used with wrap_content for size in scrolling direction, gives fatal lint error. I have resolved it by removing that line in all activities but still, I need to know why is this error fatal now, there was no such error before the update.

Sweta Jain
  • 1,884
  • 2
  • 14
  • 34

2 Answers2

2

The error is based on the RecyclerView's height, not the items inside. I noticed this error didn't show for any of my viewbinding RecyclerViews, but shows up for my findById recyclerviews, even when height is match_parent. It turns out lint is not that smart. If you have any RecyclerView in your project that uses wrap_content and has the same id as your other recyclerviews, lint gets confused and will complain, even if your other layouts all use match_parent in their RecyclerView.

My fix was to rename the id for one of my RecyclerView causing the problem (a recyclerview inside a dialog, so it's necessary to use wrap_content in there)

mliu
  • 1,707
  • 14
  • 25
0

please refer this question you will get to know reason behind it. This question is already asked in some form.

Understanding RecyclerView setHasFixedSize

Ankit Mishra
  • 466
  • 7
  • 15