Method 1:
Original URL: http://fengbohaishang.blog.51cto.com/5106297/1339556
Did not pay much attention to this problem before, do not look at the source code, now found that the source code is really a good learning resources.
Straight into the chase:
First, access to Android source resources.
This refers to the Java source files, generally about more than 10 trillion, is not the kind of online a few G Andorid SDK source code.
There are two ways: 1), from Google or Baidu search for the API version you need source resources, usually zip or jar format.
2), when upgrading the SDK version through Eclipse, there is an option to download the resources.
The last item, when checked, will download the Java source code to the SDK directory.
Second, access to the source code can be added to eclipse in the association. You can create a new Android project, or find an existing Android project, then right-click on the project, select the Properties option, then, find the Java Built path option, click on the Liberaries option on the right, Expand the corresponding Android. jar package with a source attchment option below, such as:
Then, click on the Edit option on the right:
A menu will pop up to add a resource:
The first option is to add a resource from the work path, and the second option is to add the file compression package, which is usually not recognized in the jar or Zip,rar format (this should be noted). You select your corresponding version of the ZIP compression package, click OK to slowly import into.
The third option is to add the extracted folders directly. You can find from the SDK directory of your Andorid source you downloaded through eclipse, such as the folder form, select a corresponding, click OK, slowly import can. However, this place has a problem, that is, through the third way to import, restart Eclipose, casually choose a class base class, and did not enter the source, that is, no association, I do not know what the reason (have to know the trouble to inform) .... So, I still choose to use the second method, add the form of compressed package, import into. You can view the source code.
About Android Multiple versions of the source code, you just have to re-send the different versions of the line once, and then you will see different versions of the API source code.
Source code is a very good resource, I hope you can make good use of.
This article is from the "Wind Sea" blog, please be sure to keep this source http://fengbohaishang.blog.51cto.com/5106297/1339556
Method 2:
Original URL: http://www.cnblogs.com/codingmyworld/archive/2011/07/19/2110784.html
1. Download the source code
This part of the internet has a lot of information, I will not re-write, this is my reference article: "Windows platform Android source download"
Generally speaking, follow the above article to explain the operation on the line. But my RP poor, halfway encountered a small problem: after the installation of Msysgit on the folder after the right button does not have git bash option, how to do?
My solution: Find git bash run directly from the Start menu and use the "CD Target directory path" command to enter the directory where you want to store the source code. Of course, can also be used to visualize the Git GUI operation, but it is only the next source, with command more convenient, is not it?
2. Associating source code in eclipse
People who commonly use eclipse should also be familiar with the operations associated with source code in eclipse.
First, find the Android.jar in the project, right-click →properties
Second, select External folder to associate to external folders
Third, select the% storage source directory%/base/core/java→ok. This completes the operation of the associated source code.
Four, Ctrl-click the class name or interface name to view the source code.
Done! In the future to see the document do not understand the content will not be afraid, we can directly look at the source code! Ha ha!
"Go" How to view Android source code in eclipse