{"id":49,"date":"2013-05-07T16:26:13","date_gmt":"2013-05-07T16:26:13","guid":{"rendered":"https:\/\/code4reference.com\/?p=49"},"modified":"2013-05-07T16:26:13","modified_gmt":"2013-05-07T16:26:13","slug":"code4referenceandroid-source-code-browsing","status":"publish","type":"post","link":"https:\/\/code4reference.com\/?p=49","title":{"rendered":"Code4ReferenceAndroid source code browsing"},"content":{"rendered":"<p>As an engineer, \u00a0most of the time you spend on browsing peers\u2019 code in your company. Sometimes we think that how these platforms(i.e Android, Java, etc.) have been written? Is there anyway of getting access of source code? Is there any advantage of this?<br \/>\nWell, there can be certainly some advantages. I would say, you may\u00a0consider the following points as \u00a0advantages.<\/p>\n<ul>\n<li>First hand Information. Source code browsing reveals large-scale software program.<\/li>\n<li>Increases your conceptual understanding of platform.<\/li>\n<li>Gives idea about how you can do things more precisely and efficiently. It increases your code writing skills.<\/li>\n<li>Makes you learn the coding standard and convention followed by the platform.<\/li>\n<li>Live examples .<\/li>\n<li>You may eventually contribute to the platform enhancement.<\/li>\n<\/ul>\n<ol>\n<li>Copy\/clone source code repo.<\/li>\n<li>Online source code browsing.<\/li>\n<\/ol>\n<p>If you have prior knowledge of <em>git\/repo<\/em> and <em>greping<\/em> code in source directory then this option would be useful for you. If you are not keen to learn\u00a0<em>Git<\/em> then please proceed to the next section. You can clone the Android source repo from these two places.<\/p>\n<ul>\n<li><a href=\"http:\/\/android.googlesource.com\/\">googlesource<\/a>\u00a0: If you want to clone the android googlesrouce repo you can follow instruction given\u00a0<a href=\"http:\/\/source.android.com\/source\/downloading.html\">here.<\/a><\/li>\n<li><a href=\"http:\/\/github.com\/android\">github<\/a>\u00a0: Go\u00a0<a href=\"http:\/\/github.com\/android\">here<\/a>. Select the repositiory which you want to clone. Click on the <em>Readonly<\/em> button. \u00a0You will find url in text field similar to this <em>git:\/\/github.com\/android\/android-module-repository.git<\/em> and then execute these commands:<\/li>\n<\/ul>\n<pre>$mkdir android-src\n$cd android-src\n$git clone git:\/\/github.com\/android\/android-module-git-repository.git\n<\/pre>\n<p>There are various websites available for Android source code browsing. I have listed some of them here. These are arranged in order of their usefulness to developer.<\/p>\n<ol>\n<li><a href=\"http:\/\/grepcode.com\/search\/?query=google+android&amp;entity=project\">www.grepcode.com<\/a>\u00a0: I personally like this website since it is really easy to use and handy. You can see the member function and the directory\/package structure on the same webpage. You don\u2019t need to navigate around. This website has categorized the source code in different\u00a0groups based on the module and its functionality. In case you have used Eclipse as an IDE then you will take less time to understand the user interface. There are four tabs Outlines, Files,\u00a0Hierarchy\u00a0and Comments, as we have in Eclipse IDE. In Outline tab you can browse methods and variables present in the class and its accessibility(private, protected and public). The File tab shows the folder\/directory structure. The\u00a0Hierarchy tab shows \u00a0how a particular class has been derived from other class along with its inheritance hierarchy. The Comments tab may not be so useful however it helps you to comment using your Facebook login.\u00a0There are four links available on the top of the code frame. They are Find usage, Diff, Raw, Download and HTML widget. Find usage link provides you code snippet giving you the idea about the usage of particular method\/variable \u00a0in different places. The Diff link provides the difference between the different code versions. The Raw link opens a new browser window which contains the source code. \u00a0The Download link itself suggest \u00a0what it does. The HTML Widget helps to share the source code. The most useful feature is that you can check the definition of class\/variable by clicking on its name. This website also has java source code.<\/li>\n<li><a href=\"http:\/\/androidxref.com\/\">Androidxref.com<\/a> : This website has index Android 2.3.6, 4.0.4 and 4.1.1 source code. It provides almost similar features as provided by grep.com<\/li>\n<li><a href=\"http:\/\/www.java2s.com\/Code\/Android\/CatalogAndroid.htm\">www.java2s.com<\/a>\u00a0: This is also a good resource. I will rank this site on the second place. It doesn\u2019t provide as many features as <a href=\"http:\/\/www.grepcode.com\/\">grepcode<\/a> does. But still this website can be used for code reference. It also provides code examples which can be really helpful\u00a0sometimes.<\/li>\n<li><a href=\"http:\/\/github.com\/android\">www.github.com<\/a>\u00a0: \u00a0This site is not basically designed for code browsing purpose but it can be used for the same. This website organizes the files in the same way as your hardrive does.(I host my source code on <a href=\"http:\/\/github.com\/rakeshcusat\/Code4Reference\">github<\/a>. <img alt='icon_wink-9337302' src='https:\/\/code4reference.com\/wp-content\/uploads\/2013\/05\/icon_wink-9337302.gif' \/> )<\/li>\n<\/ol>\n<p>If you are really into Android and want to browse code on your Android phone then <a href=\"http:\/\/market.android.com\/details?id=sqwady.codesearch\">this application<\/a> can be very handy. You can browse the code on the go.<br \/>\nThese two sites <a href=\"http:\/\/www.java2s.com\/Open-Source\/Java\/CatalogJava.htm\">java2s<\/a> and <a href=\"http:\/\/grepcode.com\/search\/?r=repository.grepcode.com%24java%24root&amp;start=0&amp;query=list&amp;entity=type\">grepcode<\/a>\u00a0host java source code and are really useful tools in your armour.<\/p>\n<p>If you want to install git in Ubuntu machine, you may execute command below:<\/p>\n<pre>$sudo apt-get install git <\/pre>\n<p>Your valuable comments are always welcomed. It will help to improve my post and understanding.<\/p>\n<p><em>\u201cBy three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest.\u201d<\/em><br \/>\nBy : Confucius<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As an engineer, \u00a0most of the time you spend on browsing peers\u2019 code in your company. Sometimes we think that how these platforms(i.e Android, Java, etc.) have been written? Is there anyway of getting access of source code? Is there any advantage of this? Well, there can be certainly some advantages. I would say, you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":0,"href":"https:\/\/code4reference.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"wp:attachment":[{"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code4reference.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}