2

I have for example class LivePagedListProvider that that is in the android.arch.paging package.

Is there any direct way to determine which library in gradle file this class belongs to?

Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
sandeor30r
  • 25
  • 5

3 Answers3

6

You can do this in Android Studio, by using the Navigate... Class menu option (or pressing CTRL-N on Windows).

Press CTRL-N, and when the search box opens up, start typing the name of the class you want to find.

CTRL N search for class

As the matches are shown in the list below, to the right of each match will be shown which gradle dependency this class belongs to.


If you choose to open the class, then in the top left of your screen you will also see the name of the library.

showing library that class is in

This is useful because it lets you navigate around that JAR file, by clicking the various parts of the package name, but does not give you the full gradle dependency which is shown in the search box above.

Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
  • @sandeor30r I use this `CTRL-N` all the time for navigating around my projects. you might also enjoy `CTRL-SHIFT-N` which allows you to open non-class files e.g. XML layout files or `strings.xml` – Richard Le Mesurier Dec 20 '18 at 05:54
1

A faster way I prefer is to use Search Everywhere box. Double tap shift key and in dialog that opens you can type your class name and its gradle dependency will be shown next to class name in suggestion drop-down.

karan
  • 8,637
  • 3
  • 41
  • 78
-1

Not sure you can say its the easy way, but it works for me.

For Mac, cmd+ Click (control + Left Click for Windows ) on that Class(not object) will take you to the declaration, where the Class actually exists.From that Class' package name, you can confidently tell which gradle project implementation that belong to, as both of them will be same.

touhid udoy
  • 4,005
  • 2
  • 18
  • 31