Android source code viewing and searching has always been a pain point for Android developers. Although The Android Studio tool supports downloading source code and jumping to the underlying implementation, it sometimes fails to meet our needs. The most typical example is when we need to change the source code implementation to fix a bug. For example, PopupWindow, Android 6.0 above click PopupWindow area can not disappear, we need to compare different Android versions of the different implementation, this time Android Studio directly view the source can not meet the problem.

GrepCode, Android SDK Search, and AndroidXre

Previously, we want to view a specified version of a control source code implementation, the need to download the Android source project to the local, and then open the view through the text IDE, so see the source code efficiency is very low, can not jump in the code, the search is also a bit difficult. Last year, I wrote an article about GrepCode and Android SDK Search, two online source viewing tools that are a good choice. Besides, Android Xref is also widely used.

GrepCode:

Android SDK Search:

Androidxref:

The above three methods, although the code update is slow and the experience is not good, can satisfy most of our needs. Now, we can wave them goodbye, because Google has officially released its source Code Search tool: Android Code Search.

Android Code Search

On December 18, Android officially released the source Code Search tool, the address is: cs.android.com/

Androidx contains the source code for CameraX and Jetpack Compose, among other libraries in the AndroidX family.

The current features are:

  • Easy to view, search source code
  • A code jump that cross-references an entire code base by clicking on one part of the source code to jump to another
  • Switching between open source branches of Android (not all branches have cross-reference information)

So awesome tools, finally wait until the official version of the original, West ge the first time to try, experience is very good, not only can directly jump code, but also support version switching, in the specified directory search files and global search files:

The directory on the left can be expanded, just as conveniently as the IDE

After searching for a file, a list of all matching files is listed:

After the file is selected, it will bring you to the specific class, and yesterday it will also show you all the files under the package in which the file is located, as shown below:

Mouse clicks on methods and classes can jump to specific class and method definitions, just AS well AS the AS experience, such AS statelistdrawable.java in popupWindow.java

The upper left corner allows you to easily switch versions and view each submission record:

Is almost above these functions, experience is really good, have not experienced quickly to try!

But… Need to climb the wall oh 🤣😂

Ali P6P7【 android 】 Advanced information sharing + salary job-hopping essential interview questions