Android SDK源碼安裝教程

來源:互聯網
上載者:User

Android SDK源碼安裝是本文要介紹的內容,主要是來瞭解並學習Android SDK的內容,主要是介紹在linux和windows平台下,如何下載Android SDK的原始碼,注意是sdk的原始碼,而不是android的所有原始碼,同時介紹如何把Android SDK原始碼加入到eclipse裡,使android平台手機開發人員可以直接查看原始碼,通過閱讀SDK源碼,能更好的理解和運用Android的API。

文章主要分2部份。第1部份介紹如何下載Android SDK的原始碼;第2部份介紹如何把Android SDK的原始碼加入到eclipse裡第1部份如何下載Android SDK的原始碼

1、環境。Linux2.6,Python2.4.3或windowsXP

2、工具。主要使用git工具,下載Android SDK Source。

1)Linux下git工具可以到http://git-scm.com/下載,此工具是linux的核心代碼管理工具。

安裝過程如下:

  1. tar-xvfgit-1.6.6.tar.bz2  
  2. ./configure  
  3. make  
  4. makeinstall 

(2)在Windows下安裝則和其他應用程式安裝是一樣的。

Windows下Git:

  1. http://code.google.com/p/msysgit/downloads/list 

目前最新版本為:msysGit-fullinstall-1.7.1-preview20100612.exe31.6MB

3、下載Android SDK的原始碼

Windows版本的Git提供有Linuxshell命令列和GUI圖形介面兩種不同的操作方式,

用預設安裝選項安裝時,添加在案頭上的Git表徵圖為啟動使用shell命令工具,操作指令和用法則和Linux下一樣

mkdirandroid_sdk_src建立存放Android SDK源檔案的目錄

cdandroid_sdk_src進入建立的目錄

gitclonegit://android.git.kernel.org/platform/frameworks/base.git下載Android SDK源碼

附上Android資源分布說明:

  1. http://source.android.com/projects#TOC-External-projects 

Android的Git資源:

  1. http://android.git.kernel.org/ 

Git中文教程:

  1. http://www.bitsun.com/documents/gittutorcn.htm 

Git:

  1. http://code.google.com/p/msysgit/ 

在http://android.git.kernel.org/的首頁上講得很清楚,

如果是想要獲得部分git資源Tocloneoneofthesetrees,installgit,andrun:),請使用

  1. gitclonegit://android.git.kernel.org/+projectpath.git 

附上下載整個Android SDK的方法

repo指令碼可以到http://android.git.kernel.org/repo獲得。

使用curl命令下載並部署此指令碼

  1. curlhttp://android.git.kernel.org/repo>/bin/repo  
  2. curlhttp://android.git.kernel.org/repo>~/bin/repo  
  3. chmoda+x~/bin/repo  
  4. mkdirmydroid  
  5. cdmydroid  
  6. repoinit-ugit://android.git.kernel.org/platform/manifest.git  
  7. reposync 

第2部份如何把源碼附加到eclipse裡。

此部分的詳細配置方法請查看

  1. http://stuffthathappens.com/blog/2008/11/01/browsing-android-source-in-eclipse/ 

在此對這篇文章引述如下:

1、在你的SDK目錄下,即你的android.jar所在目錄下建立sources目錄,把下載的原始碼(我的原始碼的根目錄為base)裡的base\core\java\下的檔案夾android和com複製放到sources下。具體的目錄結構如下

Android SDK路徑

  1. |android.jar  
  2. +--docs/...  
  3. +--samples/...  
  4. +--sources  
  5. +--android  
  6. |...accounts,annotation,app,bluetooth,etc...  
  7. +--com/android/etc...  
  8. +--dalvik/...  
  9. +--java/...  
  10. +--javax/... 

2、然後重新開啟eclipse,就完成了原始碼的附加。

小結:Android SDK源碼安裝的內容介紹完了,希望通過Android SDK源碼內容的學習能對你有所協助!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.