windows下如何下载android源码
在网上找了好久都没有找到如何批量下载,只是找到有位通过角本执行来进行下载的。
试了一下在我机器上运行有问题,所以索性自己搞了一个出来。
首先根据官方的说法要下载git,这个无论如何是要下载的。
点击安装,安装完成后,
在盘符上建立文件夹,我建在E:\android src下
右键选择Git bash
弹出如下界面
下面就是整理下载的过程了,如果只需要下载其中的一个包,那么就不需要做下面的操作了,如果想下载全部源码就需要做一下处理,因为windows下是没有repo的
进入下载页面
http://android.git.kernel.org/
如果只下载一个,只需要
git clone git://android.git.kernel.org/
+ project path.
将后面的project path改为下面第一列的内容即可。
这样对应的需要的包就可以下载了。
如果想下载所有的源码
在下载页面里进行选择
将页面中文件列表中的内容选择出来,并且放到文本文件中
把文件保存到androidURL.txt中
然后用程序来取出我们需要的信息
新建类ReplaceFile.java
View Code
public class ReplaceFile {
/**
* @param args
*/
public static void main(String[] args) {
String fileName = "C:/androidURL.txt";
readFileByLines(fileName);
}
private static void readFileByLines(String fileName) {
List<String> tmpList = new ArrayList<String>();// 用来存放修改后的url
File file = new File(fileName);
BufferedReader reader = null;
try {
System.out.println("以行为单位读取文件内容,一次读一整行:");
reader = new BufferedReader(new FileReader(file));
String tempString = null;
int line = 1;
// 一次读入一行,直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
// 显示行号
String splitByStr = ".git";
int tmpI = tempString.indexOf(splitByStr);
if (tmpI >= 0) {
tempString = tempString.substring(0,
tempString.indexOf(".git"));
String gitGet = "git clone git://android.git.kernel.org/";
// System.out.println("line " + line + ": " + gitGet
// + tempString + splitByStr);
System.out.println(gitGet+ tempString + splitByStr);
tmpList.add(gitGet+ tempString + splitByStr);
}
line++;
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
}
}
取出得到的文件列表如下:
View Code
git clone git://android.git.kernel.org/device/common.git
git clone git://android.git.kernel.org/device/google/accessory/arduino.git
git clone git://android.git.kernel.org/device/google/accessory/demokit.git
git clone git://android.git.kernel.org/device/htc/common.git
git clone git://android.git.kernel.org/device/htc/dream-sapphire.git
git clone git://android.git.kernel.org/device/htc/dream.git
git clone git://android.git.kernel.org/device/htc/passion-common.git
git clone git://android.git.kernel.org/device/htc/passion.git
git clone git://android.git.kernel.org/device/htc/sapphire.git
git clone git://android.git.kernel.org/device/sample.git
git clone git://android.git.kernel.org/device/samsung/crespo.git
git clone git://android.git.kernel.org/device/samsung/crespo4g.git
git clone git://android.git.kernel.org/kernel/common.git
git clone git://android.git.kernel.org/kernel/experimental.git
git clone git://android.git.kernel.org/kernel/linux-2.6.git
git clone git://android.git.kernel.org/kernel/lk.git
git clone git://android.git.kernel.org/kernel/msm.git
git clone git://android.git.kernel.org/kernel/omap.git
git clone git://android.git.kernel.org/kernel/qemu.git
git clone git://android.git.kernel.org/kernel/samsung.git
git clone git://android.git.kernel.org/kernel/tegra.git
git clone git://android.git.kernel.org/platform/bionic.git
git clone git://android.git.kernel.org/platform/bootable/bootloader/legacy.git
git clone git://android.git.kernel.org/platform/bootable/diskinstaller.git
git clone git://android.git.kernel.org/platform/bootable/recovery.git
git clone git://android.git.kernel.org/platform/bootloader/legacy.git
git clone git://android.git.kernel.org/platform/build.git
git clone git://android.git.kernel.org/platform/cts.git
git clone git://android.git.kernel.org/platform/dalvik.git
git clone git://android.git.kernel.org/platform/development.git
git clone git://android.git.kernel.org/platform/external/aes.git
git clone git://android.git.kernel.org/platform/external/alsa-lib.git
git clone git://android.git.kernel.org/platform/external/alsa-utils.git
git clone git://android.git.kernel.org/platform/external/apache-http.git
git clone git://android.git.kernel.org/platform/external/apache-qp.git
git clone git://android.git.kernel.org/platform/external/astl.git
git clone git://android.git.kernel.org/platform/external/bison.git
git clone git://android.git.kernel.org/platform/external/blktrace.git
git clone git://android.git.kernel.org/platform/external/bluetooth/bluez.git
git clone git://android.git.kernel.org/platform/external/bluetooth/glib.git
git clone git://android.git.kernel.org/platform/external/bluetooth/hcidumb.git
git clone git://android.git.kernel.org/platform/external/bluetooth/hcidump.git
git clone git://android.git.kernel.org/platform/external/bluez.git
git clone git://android.git.kernel.org/platform/external/bouncycastle.git
git clone git://android.git.kernel.org/platform/external/bsdiff.git
git clone git://android.git.kernel.org/platform/external/bzip2.git
git clone git://android.git.kernel.org/platform/external/chromium.git
git clone git://android.git.kernel.org/platform/external/clearsilver.git
git clone git://android.git.kernel.org/platform/external/dbus.git
git clone git://android.git.kernel.org/platform/external/dhcpcd.git
git clone git://android.git.kernel.org/platform/external/dnsmasq.git
git clone git://android.git.kernel.org/platform/external/dosfstools.git
git clone git://android.git.kernel.org/platform/external/dropbear.git
git clone git://android.git.kernel.org/platform/external/e2fsprogs.git
git clone git://android.git.kernel.org/platform/external/easymock.git
git clone git://android.git.kernel.org/platform/external/eglib.git
git clone git://android.git.kernel.org/platform/external/elfcopy.git
git clone git://android.git.kernel.org/platform/external/elfutils.git
git clone git://android.git.kernel.org/platform/external/embunit.git
git clone git://android.git.kernel.org/platform/external/emma.git
git clone git://android.git.kernel.org/platform/external/esd.git
git clone git://android.git.kernel.org/platform/external/expat.git
git clone git://android.git.kernel.org/platform/external/fdlibm.git
git clone git://android.git.kernel.org/platform/external/freetype.git
git clone git://android.git.kernel.org/platform/external/fsck_msdos.git
git clone git://android.git.kernel.org/platform/external/gdata.git
git clone git://android.git.kernel.org/platform/external/genext2fs.git
git clone git://android.git.kernel.org/platform/external/giflib.git
git clone git://android.git.kernel.org/platform/external/googleclient.git
git clone git://android.git.kernel.org/platform/external/grub.git
git clone git://android.git.kernel.org/platform/external/gtest.git
git clone git://android.git.kernel.org/platform/external/guava.git
git clone git://android.git.kernel.org/platform/external/harfbuzz.git
git clone git://android.git.kernel.org/platform/external/hcidump.git
git clone git://android.git.kernel.org/platform/external/hyphenation.git
git clone git://android.git.kernel.org/platform/external/icu4c.git
git clone git://android.git.kernel.org/platform/external/iproute2.git
git clone git://android.git.kernel.org/platform/external/ipsec-tools.git
git clone git://android.git.kernel.org/platform/external/iptables.git
git clone git://android.git.kernel.org/platform/external/jdiff.git
git clone git://android.git.kernel.org/platform/external/jhead.git
git clone git://android.git.kernel.org/platform/external/jpeg.git
git clone git://android.git.kernel.org/platform/external/jsilver.git
git clone git://android.git.kernel.org/platform/external/jsr305.git
git clone git://android.git.kernel.org/platform/external/junit.git
git clone git://android.git.kernel.org/platform/external/kernel-headers.git
git clone git://android.git.kernel.org/platform/external/lcc.git
git clone git://android.git.kernel.org/platform/external/libffi.git
git clone git://android.git.kernel.org/platform/external/libgsm.git
git clone git://android.git.kernel.org/platform/external/libnfc-nxp.git
git clone git://android.git.kernel.org/platform/external/libpcap.git
git clone git://android.git.kernel.org/platform/external/libpng.git
git clone git://android.git.kernel.org/platform/external/libvpx.git
git clone git://android.git.kernel.org/platform/external/libxml2.git
git clone git://android.git.kernel.org/platform/external/libxslt.git
git clone git://android.git.kernel.org/platform/external/mtd-utils.git
git clone git://android.git.kernel.org/platform/external/mtpd.git
git clone git://android.git.kernel.org/platform/external/netcat.git
git clone git://android.git.kernel.org/platform/external/netperf.git
git clone git://android.git.kernel.org/platform/external/neven.git
git clone git://android.git.kernel.org/platform/external/nist-sip.git
git clone git://android.git.kernel.org/platform/external/oauth.git
git clone git://android.git.kernel.org/platform/external/opencore.git
git clone git://android.git.kernel.org/platform/external/openssl.git
git clone git://android.git.kernel.org/platform/external/openvpn.git
git clone git://android.git.kernel.org/platform/external/oprofile.git
git clone git://android.git.kernel.org/platform/external/ping.git
git clone git://android.git.kernel.org/platform/external/ppp.git
git clone git://android.git.kernel.org/platform/external/proguard.git
git clone git://android.git.kernel.org/platform/external/protobuf.git
git clone git://android.git.kernel.org/platform/external/qemu-pc-bios.git
git clone git://android.git.kernel.org/platform/external/qemu.git
git clone git://android.git.kernel.org/platform/external/quake.git
git clone git://android.git.kernel.org/platform/external/safe-iop.git
git clone git://android.git.kernel.org/platform/external/skia.git
git clone git://android.git.kernel.org/platform/external/sonivox.git
git clone git://android.git.kernel.org/platform/external/speex.git
git clone git://android.git.kernel.org/platform/external/sqlite.git
git clone git://android.git.kernel.org/platform/external/srec.git
git clone git://android.git.kernel.org/platform/external/stlport.git
git clone git://android.git.kernel.org/platform/external/strace.git
git clone git://android.git.kernel.org/platform/external/svox.git
git clone git://android.git.kernel.org/platform/external/tagsoup.git
git clone git://android.git.kernel.org/platform/external/tcpdump.git
git clone git://android.git.kernel.org/platform/external/tesseract.git
git clone git://android.git.kernel.org/platform/external/tinyxml.git
git clone git://android.git.kernel.org/platform/external/tremolo.git
git clone git://android.git.kernel.org/platform/external/tremor.git
git clone git://android.git.kernel.org/platform/external/v8.git
git clone git://android.git.kernel.org/platform/external/webkit.git
git clone git://android.git.kernel.org/platform/external/webp.git
git clone git://android.git.kernel.org/platform/external/wpa_supplicant.git
git clone git://android.git.kernel.org/platform/external/wpa_supplicant_6.git
git clone git://android.git.kernel.org/platform/external/xdelta3.git
git clone git://android.git.kernel.org/platform/external/xmlwriter.git
git clone git://android.git.kernel.org/platform/external/yaffs2.git
git clone git://android.git.kernel.org/platform/external/zlib.git
git clone git://android.git.kernel.org/platform/frameworks/base.git
git clone git://android.git.kernel.org/platform/frameworks/ex.git
git clone git://android.git.kernel.org/platform/frameworks/opt/carddav.git
git clone git://android.git.kernel.org/platform/frameworks/opt/com.google.android.git
git clone git://android.git.kernel.org/platform/frameworks/opt/com.google.android.googlelogin.git
git clone git://android.git.kernel.org/platform/frameworks/opt/emoji.git
git clone git://android.git.kernel.org/platform/frameworks/policies/base.git
git clone git://android.git.kernel.org/platform/hardware/alsa_sound.git
git clone git://android.git.kernel.org/platform/hardware/broadcom/wlan.git
git clone git://android.git.kernel.org/platform/hardware/htc/dream.git
git clone git://android.git.kernel.org/platform/hardware/libhardware.git
git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git
git clone git://android.git.kernel.org/platform/hardware/msm7k.git
git clone git://android.git.kernel.org/platform/hardware/qcom/gps.git
git clone git://android.git.kernel.org/platform/hardware/qcom/media.git
git clone git://android.git.kernel.org/platform/hardware/ril.git
git clone git://android.git.kernel.org/platform/hardware/ti/omap3.git
git clone git://android.git.kernel.org/platform/hardware/ti/wlan.git
git clone git://android.git.kernel.org/platform/libcore.git
git clone git://android.git.kernel.org/platform/manifest.git
git clone git://android.git.kernel.org/platform/ndk.git
git clone git://android.git.kernel.org/platform/packages/apps/AccountsAndSyncSettings.git
git clone git://android.git.kernel.org/platform/packages/apps/AlarmClock.git
git clone git://android.git.kernel.org/platform/packages/apps/Bluetooth.git
git clone git://android.git.kernel.org/platform/packages/apps/Browser.git
git clone git://android.git.kernel.org/platform/packages/apps/Calculator.git
git clone git://android.git.kernel.org/platform/packages/apps/Calendar.git
git clone git://android.git.kernel.org/platform/packages/apps/Camera.git
git clone git://android.git.kernel.org/platform/packages/apps/CertInstaller.git
git clone git://android.git.kernel.org/platform/packages/apps/Contacts.git
git clone git://android.git.kernel.org/platform/packages/apps/DeskClock.git
git clone git://android.git.kernel.org/platform/packages/apps/Email.git
git clone git://android.git.kernel.org/platform/packages/apps/Gallery.git
git clone git://android.git.kernel.org/platform/packages/apps/Gallery3D.git
git clone git://android.git.kernel.org/platform/packages/apps/GlobalSearch.git
git clone git://android.git.kernel.org/platform/packages/apps/GoogleSearch.git
git clone git://android.git.kernel.org/platform/packages/apps/HTMLViewer.git
git clone git://android.git.kernel.org/platform/packages/apps/IM.git
git clone git://android.git.kernel.org/platform/packages/apps/Launcher.git
git clone git://android.git.kernel.org/platform/packages/apps/Launcher2.git
git clone git://android.git.kernel.org/platform/packages/apps/Mms.git
git clone git://android.git.kernel.org/platform/packages/apps/Music.git
git clone git://android.git.kernel.org/platform/packages/apps/Nfc.git
git clone git://android.git.kernel.org/platform/packages/apps/OTAProvisioningClient.git
git clone git://android.git.kernel.org/platform/packages/apps/PackageInstaller.git
git clone git://android.git.kernel.org/platform/packages/apps/Phone.git
git clone git://android.git.kernel.org/platform/packages/apps/Protips.git
git clone git://android.git.kernel.org/platform/packages/apps/Provision.git
git clone git://android.git.kernel.org/platform/packages/apps/QuickSearchBox.git
git clone git://android.git.kernel.org/platform/packages/apps/Settings.git
git clone git://android.git.kernel.org/platform/packages/apps/SoundRecorder.git
git clone git://android.git.kernel.org/platform/packages/apps/SpeechRecorder.git
git clone git://android.git.kernel.org/platform/packages/apps/Stk.git
git clone git://android.git.kernel.org/platform/packages/apps/Sync.git
git clone git://android.git.kernel.org/platform/packages/apps/Tag.git
git clone git://android.git.kernel.org/platform/packages/apps/Updater.git
git clone git://android.git.kernel.org/platform/packages/apps/VoiceDialer.git
git clone git://android.git.kernel.org/platform/packages/experimental.git
git clone git://android.git.kernel.org/platform/packages/inputmethods/LatinIME.git
git clone git://android.git.kernel.org/platform/packages/inputmethods/OpenWnn.git
git clone git://android.git.kernel.org/platform/packages/inputmethods/PinyinIME.git
git clone git://android.git.kernel.org/platform/packages/providers/ApplicationsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/CalendarProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/ContactsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/DownloadProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/DrmProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/GoogleContactsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/GoogleSubscribedFeedsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/ImProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/ManagementProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/MediaProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/TelephonyProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/UserDictionaryProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/WebSearchProvider.git
git clone git://android.git.kernel.org/platform/packages/services/EasService.git
git clone git://android.git.kernel.org/platform/packages/services/LockAndWipe.git
git clone git://android.git.kernel.org/platform/packages/wallpapers/Basic.git
git clone git://android.git.kernel.org/platform/packages/wallpapers/LivePicker.git
git clone git://android.git.kernel.org/platform/packages/wallpapers/MagicSmoke.git
git clone git://android.git.kernel.org/platform/packages/wallpapers/MusicVisualization.git
git clone git://android.git.kernel.org/platform/prebuilt.git
git clone git://android.git.kernel.org/platform/recovery.git
git clone git://android.git.kernel.org/platform/sdk.git
git clone git://android.git.kernel.org/platform/system/bluetooth.git
git clone git://android.git.kernel.org/platform/system/core.git
git clone git://android.git.kernel.org/platform/system/extras.git
git clone git://android.git.kernel.org/platform/system/media.git
git clone git://android.git.kernel.org/platform/system/netd.git
git clone git://android.git.kernel.org/platform/system/vold.git
git clone git://android.git.kernel.org/platform/system/wlan/broadcom.git
git clone git://android.git.kernel.org/platform/system/wlan/ti.git
git clone git://android.git.kernel.org/platform/tools/tradefederation.git
git clone git://android.git.kernel.org/platform/vendor/aosp.git
git clone git://android.git.kernel.org/platform/vendor/asus/eee_701.git
git clone git://android.git.kernel.org/platform/vendor/csr/unifi-105x.git
git clone git://android.git.kernel.org/platform/vendor/csr/unifi-60xx.git
git clone git://android.git.kernel.org/platform/vendor/htc/common-open.git
git clone git://android.git.kernel.org/platform/vendor/htc/dream-open.git
git clone git://android.git.kernel.org/platform/vendor/htc/prebuilt-open.git
git clone git://android.git.kernel.org/platform/vendor/htc/sapphire-open.git
git clone git://android.git.kernel.org/platform/vendor/pv-open.git
git clone git://android.git.kernel.org/platform/vendor/qcom/android-open.git
git clone git://android.git.kernel.org/platform/vendor/qcom/proprietary-open.git
git clone git://android.git.kernel.org/platform/vendor/qcom/surf.git
git clone git://android.git.kernel.org/platform/vendor/renesas/ms7724.git
git clone git://android.git.kernel.org/platform/vendor/sample.git
git clone git://android.git.kernel.org/platform/vendor/st-ericsson/u300.git
git clone git://android.git.kernel.org/toolchain/benchmark.git
git clone git://android.git.kernel.org/toolchain/binutils.git
git clone git://android.git.kernel.org/toolchain/build.git
git clone git://android.git.kernel.org/toolchain/gcc.git
git clone git://android.git.kernel.org/toolchain/gdb.git
git clone git://android.git.kernel.org/toolchain/gmp.git
git clone git://android.git.kernel.org/toolchain/gold.git
git clone git://android.git.kernel.org/toolchain/manifest.git
git clone git://android.git.kernel.org/toolchain/mpc.git
git clone git://android.git.kernel.org/toolchain/mpfr.git
git clone git://android.git.kernel.org/tools/android-issuetrackerredirect.git
git clone git://android.git.kernel.org/tools/executablewar.git
git clone git://android.git.kernel.org/tools/gerrit-contactstore.git
git clone git://android.git.kernel.org/tools/gerrit-keyapplet.git
git clone git://android.git.kernel.org/tools/gerrit.git
git clone git://android.git.kernel.org/tools/gimd.git
git clone git://android.git.kernel.org/tools/gwtexpui.git
git clone git://android.git.kernel.org/tools/gwtjsonrpc.git
git clone git://android.git.kernel.org/tools/gwtorm.git
git clone git://android.git.kernel.org/tools/manifest.git
git clone git://android.git.kernel.org/tools/protobuf.git
git clone git://android.git.kernel.org/tools/repo.git
git clone git://android.git.kernel.org/tools/test/manifest.git
git clone git://android.git.kernel.org/tools/test/project0.git
我是将信息直接输出到控制台,这个是比较新的版本,如果再有更新可以用以上的方法更新下面的配置文件
在git的控制台上
点击左上角点击编缉,粘贴
然后就是等待,等待...........