Eclipse Android原始碼新下載方法及關聯

來源:互聯網
上載者:User

標籤:

一.下載Android原始碼

Android原始碼從4.0後就可以使用SDK Manager進行下載,開啟SDK Manager就可以看到,已4.4為例:

關聯Android原始碼

但是老是提示下載失敗,逾時串連,估計是https搞得鬼。<喎?"http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+PGltZyBzcmM9"http://www.2cto.com/uploadfile/Collfiles/20140304/20140304081201261.jpg" alt="\">

通過查看這個Android SDK Manager Log視窗中開始的地方有Fetch的行為,所有手動在瀏覽器中開啟了這個檔案:

開啟這個檔案可以發現其中的內容是:

1.121
Android SDK Platform 1.1_r1http://developer.android.com/sdk/android-1.1.html
...
219
21819439433a1d043ef77561571250e94cb7a0ef24a202e7sources-19_r02.zip
可以看出,SDK Manager下載時通過解析此檔案,然後再根據使用者所選進行相應的下載。

 找到Android API 19處,可以看到其中有個:

sources-19_r02.zip
估計是此檔案的,通過查看日誌可以發現,檔案的拿取都是在https://dl.google.com/android/repository/下進行的,所以在此網址後面加上source-19_r02.zip,然後斷行符號,果然開始下載並下載下來了。

二.關聯Android原始碼
開啟Eclipse,隨便建立一個Android項目,在此項目目錄下面有個Android 4.4,點擊展開遍出現了android.jar。右鍵此包---->Properties,在彈出的視窗中,選擇 Java Source Attachment------>External Location------>External File, 然後選擇下載下來的source-19_r02.zip,便成功在Eclipse中綁定Android原始碼。
1.右鍵android.jar


2.選擇source-19_r02.zip的位置

3.ctl+滑鼠左鍵 跳轉到原始碼

在想要查看原始碼的地方,ctl+滑鼠左鍵就可以跳轉到原始碼的地方。以Activity為例:

操作後便跳轉到原始碼部分:

 

 



Eclipse Android原始碼新下載方法及關聯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.