我在哪里可以在线找到 Android 源代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/449763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where can I find Android source code online?
提问by pupeno
Particularly, where can I browse the source code for any android source application(e.g.the contact application) ? Is the only way to go to download all there is?
特别是,我可以在哪里浏览任何 android 源应用程序(例如联系人应用程序)的源代码?是下载所有内容的唯一方法吗?
采纳答案by richq
Everything is mirrored on omapzoom.org. Some of the code is also mirrored on github.
所有内容都反映在omapzoom.org 上。部分代码也在github 上有镜像。
Contacts is herefor example.
例如,联系人在这里。
Since December 2019, you can use the new official public code search tool for AOSP: cs.android.com. There's also the Android official source browser(based on Gitiles) has a web view of many of the different parts that make up android. Some of the projects (such as Kernel) have been removed and it now only points you to clonable git repositories.
自 2019 年 12 月起,您可以使用新的 AOSP 官方公共代码搜索工具:cs.android.com。还有 Android 官方源代码浏览器(基于Gitiles)具有构成 android 的许多不同部分的 Web 视图。一些项目(例如 Kernel)已被删除,现在它只会将您指向可克隆的 git 存储库。
To get all the code locally, you can use the repohelper program, or you can just clone individual repositories.
要在本地获取所有代码,您可以使用repo帮助程序,或者您可以只克隆单个存储库。
And others:
和别的:
回答by Blundell
2020: The official AOSP code search https://cs.android.com/
2020:官方AOSP代码搜索https://cs.android.com/
You can view the source code through http://developer.android.com, when you're reading the API there will be a link to the matching source code on GitHub, you just need to add the Android SDK Reference Search Pluginon Chrome.
您可以通过http://developer.android.com查看源代码,当您阅读 API 时,GitHub 上会有匹配源代码的链接,您只需要在 Chrome 上添加Android SDK Reference Search Plugin.
I blogged about it here:
http://blog.blundellapps.com/add-source-code-links-to-android-apis/
我在这里写了博客:http:
//blog.blundellapps.com/add-source-code-links-to-android-apis/
回答by scorpiodawg
I stumbled across Android XRefthe other day and found it useful, especially since it is backed by OpenGrok which offers insanely awesome and blindingly fast search.
前几天我偶然发现了Android XRef并发现它很有用,特别是因为它得到了 OpenGrok 的支持,它提供了非常棒和令人眼花缭乱的快速搜索。
回答by pupeno
I've found a way to get only the Contacts application:
我找到了一种只获取联系人应用程序的方法:
git clone https://android.googlesource.com/platform/packages/apps/Contacts
which is good enough for me for now, but doesn't answer the question of browsing the code on the web.
这对我来说已经足够了,但没有回答在网络上浏览代码的问题。
回答by Eyal
You can browse Android SDK samples from your smartphone using "Code Search": https://market.android.com/details?id=sqwady.codesearch
您可以使用“代码搜索”从您的智能手机浏览 Android SDK 示例:https: //market.android.com/details?id=sqwady.codesearch
回答by Rangel Reale
This eclipse plugin allows for inline source viewing and even stepping inside the Android source code:
这个 eclipse 插件允许查看内联源代码,甚至可以进入 Android 源代码:
http://code.google.com/p/adt-addons/
http://code.google.com/p/adt-addons/
(edit: specifically the "Android Sources" plugin: http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/)
(编辑:特别是“Android Sources”插件:http: //adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/)
回答by Peter Boughton
gitweb will allow you to browse through the code (and changes) via a browser.
gitweb 将允许您通过浏览器浏览代码(和更改)。
http://git.or.cz/gitwiki/Gitweb
http://git.or.cz/gitwiki/Gitweb
(Don't know if someone has already setup a public gitweb for Android, but it's probably not too hard.)
(不知道有没有人已经为Android设置了一个公共的gitweb,不过应该不会太难。)