简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM