Should I add RecyclerView dependency to gradle if it works without it?

Viewed 436

I have some android projects, where I use often use RecyclerView(if it matters, it's the widget with androidx prefix) without adding any dependencies. But when I look gradle-files of another projects(even which developed by Google), I see this dependency:

implementation "androidx.recyclerview:recyclerview:$recycler_view_version"

So, I have questions.

  1. Should I add it to my gradle if I don't have any problems with RecyclerView?
  2. Maybe is there another dependency, which includes RecyclerView as well?
1 Answers

It seems that you have created your project in androix.

Material dependency :-

implementation 'com.google.android.material:material:1.2.1'

Basically material dependency contains all the widgets implementation. So you can access those widgets directly after injecting this dependency.

It may be possible that you have added material dependency in your gradle. so after injection of material dependency no need to inject separate recyclerview's dependency.

Related