Android拓展系列(10)--使用Android Studio閱讀整個Android源碼

來源:互聯網
上載者:User

標籤:android   des   style   blog   class   code   

之前一直在windows下用source insight閱讀android源碼,效果非常好。
後來遠程異地伺服器,網路限制,一直用ssh + vim,現在主要還是以這種方式。
最近發現一個不錯的東西(早就有了),在android源碼中有這麼一個目錄development/tools/idegen。
顧名思義,是產生ide的project檔案,主要是產生intellij的project檔案,當然夜可用於android studio。
使用之後,發現效果超棒,所以這裡專門撰文推薦。

1、

2、編譯idegen模組
源碼要編過,不然idegen沒法產生。
提示:

?
1 2 3 4 5 // 找不到idegen,需要全域編譯一下 /* ubuntu:~/Data/cyanogenmod$ . development/tools/idegen/idegen.sh Couldn‘t find idegen.jar. Please run make first. */

但是我相信很多看源碼的人是不需要編譯的,所以只要我上傳一個idegen.jar:
http://jayfeng-files.stor.sinaapp.com/idegen.jar
把這個檔案copy到out/host/linux-x86/framework/目錄下:

?
1 $ cp idegen.jar ../cyanogenmod/out/host/linux-x86/framework/idegen.jar

然後在cyanogenmod目錄下執行:

?
1 2 3 4 5 /* $ . development/tools/idegen/idegen.sh Read excludes: 21ms Traversed tree: 54700ms */

在我的電腦上花了54s多產生完畢,查看目錄,多了2個檔案:android.ipr和android.iml。

3、匯入到android studio
開啟Android studio,點擊File > Open,選擇剛剛產生的android.ipr就好了。
過一會兒可以在android studio完美開啟了,如前面的

4、小結
可以結合android studio,介面,智能提示都比source insight要好,超贊!

聯繫我們

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