---
title: "Eclipse里查看Android源码"
author: "happy90"
date: "2011-12-09T17:42:58Z"
tags: []
categories: ["移动开发"]
slug: "eclipse-android"
draft: false
lastmod: "2011-12-09T17:45:30Z"
id: 1300133
url: "https://happy90.iteye.com/blog/1300133"
---

关于Android的有些问题如果不查看源代码是很难搞清楚的，在网上找了一些文章，说的不是很好，现总结一下，先看两张照片：

想看android的.java源码，点F3后提示找不到源码：

![](http://dl.iteye.com/upload/attachment/603452/548cb10c-bb66-3c0b-8bd6-6236e6a3d206.png)

 

 

将源码导入后，即可查看了：

![](http://dl.iteye.com/upload/attachment/603454/8465315d-5a8a-3d3d-a6f5-f8ebcfdbe28c.png)

接下来就是应该怎么做：

1\. Android,  .java文件源码下载地址：[http://rgruet.free.fr/public/](http://rgruet.free.fr/public/)  你想要那个版本的源码就点那个超链接

2\. 在 ${ANDROID\_HOME}\\platforms\\android-x\\ 目录下创建 sources 目录

3\. 将第一步中下载的源代码文件解压到第二步创建的那个sources目录下即可，注意android-x目录和你下载的的源码版本对应即可

4\. 此时，你的SDk目录结构应该是这个样子的：

 

```
DK_PATH
  | android.jar
  +--docs/...
  +--samples/...
  +--sources
       +--android
       |      ...accounts, annotation, app, bluetooth, etc...
       +--com/android/etc...
       +--dalvik/...
       +--java/... 
```

+--javax/...   

最后，重启Eclipse即可。

 

 

 

参考文章：

 

[http://www.52rd.com/Blog/Detail\_RD.Blog\_chenyl76\_24218.html](http://www.52rd.com/Blog/Detail_RD.Blog_chenyl76_24218.html)

 

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

 

[http://rgruet.free.fr/public/](http://rgruet.free.fr/public/)