【转】Android源代码查看途径

原文网址:http://www.it165.net/pro/html/201501/32967.html

作为一个android coder,多阅读android源码对提高android开发水平是很有帮助的,那么我们可以通过哪些途径查看android源码呢

1.如果你能够FQ的话可以去android官网查看源码 http://developer.android.com/reference/packages.html

2.http://androidxref.com/5.0.0_r2/

androidxref 还可以查看android的所有版本,只需将 http://androidxref.com/5.0.0_r2 的后缀5.0.0_r2 改成相应的版本即可

3、http://grepcode.com/project/repository.grepcode.com/java/ext/com.google.android/android/

跟androidxref 一样,grepcode也可以查看android的各个版本,速度比androidxref 要快

4.https://android.googlesource.com/?format=HTML

 5、IDE中查看

在SDK manager中下载SDK对应的版本即可

6. 一个chrome内核浏览器插件:Android SDK Reference Search 

这个插件可以直接到扩展中心里搜索

https://chrome.google.com/webstore/search/Android%20SDK%20Reference%20Search%20

安装了这个插件之后就可以直接到android api官方网:http://developer.android.com/reference/packages.html

随便查找一个类:例如Activity:http://developer.android.com/reference/android/app/Activity.html

然后我们就可以看到在Aitivity后面多了个(view source),如下


点击(view source)进去,就可以直接跳转到谷歌提供的在线官方源代码处:

https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/app/Activity.java

1. Adds an 'ad' command to the Chrome Omnibox. For example, typing 'ad ViewGro' will bring up a list of all class names in the Android SDK matching 'ViewGro'—selecting a list item navigates to the relevant Android SDK Reference URL on developer.android.com.

2. Adds a '(view source)' link next to the SDK class name for class reference pages on developer.android.com. Clicking this link navigates to the relevant Google Code Search results from android.git.kernel.org.

Source code available at the link below:

    https://github.com/romannurik/AndroidSDKSearchExtension

————————

原文地址:https://www.cnblogs.com/wi100sh/p/4938450.html