How can I check out Android source code in Windows OS?
I try to search for it but I just cant. I am running Windows 7 on Lenovo G460 laptop. I tried to install Ubuntu on it but I cannot use Wireless to connect to the internet for so开发者_Python百科me reason.
Is there anyway for me to get a look at Android source code or at least just the Calendar part of it?
You can browse the android source code using their repository browser. If you want to check out a specific project (i.e. download the source), you will need to get the version control system Git. When you have Git running, you can either clone a complete repository using git clone https://android.googlesource.com/projectname.git
or just get the HEAD (the most current version of all files, useful if you only want to browse through the source) by doing git clone --depth 1 https://android.googlesource.com/projectname.git
.
The project name is the top folder you select on the repository browser, for example platform/packages/apps/Calendar
for the Calendar app. Then the full command is git clone https://android.googlesource.com/platform/packages/apps/Calendar
.
The GitWeb and Google Code Search repositories for Android have been retired since this question was originally answered. Fortunately, the SDK Manager finally allows you to download the source code for Android 4.0 and later along with all of the APIs and tools.
If you need access to pre-Ice Cream Sandwich (4.0) Android source code and don't want to use Google's non-Windows download instructions, you can search GrepCode for what you need online. (Look for "android" and the name of the class or method you want, and then pick the version of the code you want.) GrepCode works, but I have seen it crash IE a bunch of times. An alternative would be to download the Android Sources plugin for Eclipse, which gives you all of the source code for versions of Android up to 4.0.1.
Once you have the source code, you can attach the source directory you are using to your .jar in Eclipse, as follows:
Right-click the project > Properties > Java Build Path > Libraries tab > select the + beside the .jar you want to attach source code to > click on Source Attachment to edit the path to where the source files reside.
Thanks a lot, a quick guide on helping the download in windows, check this
http://honey200.wordpress.com/2011/11/17/download-android-source-code-in-windows/
Steps:
- Download Cygwin from http://cygwin.com/install.html.
- Install cygwin with almost all defaults. During cygwin setup, select modules
curl
andpython
(search for them) and mark them to be installed. Start cygwin.exe and go to your preferred directory (mine is
D:/Android/sources/4.0/try2
). Example:$: cd /cygdrive/d/Android/sources/4.0/try2
Run the below instructions one by one:
i)
mkdir bin
ii)
PATH=/cygdrive/d/Android/sources/4.0/try2/bin:$PATH
iii)
curl https://storage.googleapis.com/git-repo-downloads/repo > /cygdrive/d/Android/sources/4.0/try2/bin/repo
iv)
mkdir source
v)
cd source
vi)
Master branch:
repo init -u https://android.googlesource.com/platform/manifest
4.0.1 branch for example:
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
vii) Give credentials if needed
viii)
repo sync
Source: click here
1) Install Git: http://git-scm.com/
2) Open Git Bash
from Start Menu > Git > Git Bash
3) In Git Bash window, change current directory to your favorite directory (For example D:\android_src) by following command: cd /d/androidsrc/
4) In Windows Explorer, create an empty file D:\android_src\download.sh
and open it by notepad
5) Open the following link and copy the code & paste it into D:\android_src\download.sh
, then save and close the notepad:
http://pastebin.com/DfqBFKnK
6) Execute download shell script in Git Bash window by following command: ./download.sh
See also: https://android.googlesource.com/
Install cygwin, and install the cygwin verion of git, then follow the normal instructions for installing repo.
You'll want to have git around anyway - it's become the standard vcsfor modern dev work. Some stuff is in svn still, but that's dying out.
For me the easiest way is to browse it on GrepCode.
精彩评论