eclipse 查看android源码

最近用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的了。  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值