eclipse 查看android源碼

來源:互聯網
上載者:User

最近用eclipse開發android程式,發現查看android sdk源碼,報如下錯誤:

Source not found

The JAR of this class file belongs to container 'Android 2.0' which does not allow modification to source attachments on its entries


一般的SDK是不帶源碼的,就需要到網上去下載

repo init -u git://android.git.kernel.org/platform/manifest.git
repo sync

(www.android.git.kernel.org 是android源碼網站)


我是從網上別人整理現成的下載的,版本是android 2.0 ,這個是:http://download.csdn.net/source/1873037


1.   在相應版本號碼的檔案夾下建立檔案夾sources(必須是這個名字)

  比如:android-sdk-linux_x86/platforms/android-2.0/sources

2.   把下載下來的源檔案放到sources檔案夾下。

3.   重啟eclipse


這樣就可以查看源碼了。

相關解決文章: http://android.opensourceror.org/2010/01/18/android-source/

http://blog.michael-forster.de/2008/12/view-android-source-code-in-eclipse.html

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


ps:  開始我的項目工程是建立在android-2.2的,為了加進源碼,自己在android-sdk-linux_x86/platforms/android-8/ 下瞎弄,結果導致工程出錯,錯誤如下:


android.hello.helloActivity does not extend android.app.Activity    AndroidManifest.xml    /hello    line 8 


不知道了是什麼原因,現在也不想花時間去查了,就把工程改為2.0的了。  

聯繫我們

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