简体   繁体   English

我可以确定哪个库类属于哪个?

[英]Can I determine which library class belong?

I have for example class LivePagedListProvider that that is in the android.arch.paging package. 我有一个类LivePagedListProvider ,它位于android.arch.paging包中。

Is there any direct way to determine which library in gradle file this class belongs to? 有没有直接的方法来确定这个类属于gradle文件中的哪个库?

You can do this in Android Studio, by using the Navigate... Class menu option (or pressing CTRL-N on Windows). 您可以在Android Studio中使用“ 导航...类”菜单选项(或在Windows上按CTRL-N )执行此操作。

Press CTRL-N , and when the search box opens up, start typing the name of the class you want to find. CTRL-N ,当搜索框打开时,开始键入要查找的类的名称。

CTRL N搜索课程

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. 由于匹配显示在下面的列表中,因此将显示每个匹配的右侧该类属于哪个gradle依赖项。


If you choose to open the class, then in the top left of your screen you will also see the name of the library. 如果您选择打开课程,则在屏幕的左上角您还会看到该库的名称。

显示该类所在的库

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. 这很有用,因为它允许您通过单击包名称的各个部分来浏览该JAR文件,但不会为您提供上面搜索框中显示的完整gradle依赖项。

A faster way I prefer is to use Search Everywhere box. 我更喜欢的一种更快的方法是使用Search Everywhere框。 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. 双击shift键,在打开的对话框中,您可以键入您的类名,其gradle依赖关系将显示在建议下拉菜单中的类名旁边。

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. 对于Mac,该类(非对象)上的cmd + Click( control + Left Click适用于Windows)将带您进入类实际存在的声明。从该类的包名称,您可以自信地告诉哪个gradle项目implementation属于,因为它们都是一样的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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