与Android源代码编辑相关的一切操作介绍

Android源代码相关

注:以下是在ubuntu 10.04中进行的。此文章的诞生,是我在魅族实习的这两个月来所学到的,有从同事身上学习到的,有因为工作上产生了此疑问而google到的。转载请注明出处。

 

一、更新ubuntu 10.04的软件源

# 用如下两句命令修改更新软件源列表

# 编辑源列表

sudo gedit /etc/apt/sources.list

 

# 更新源列表

sudo apt-get update

# 如果有错误信息,把不能连接的源删除后再重新支行 sudo apt-get update

 

# 升级系统,此步不用执行,此处只是记录下这个操作而已

sudo apt-get upgrade

 

# 以下源列表来自 http://wiki.ubuntu.org.cn/index.php?title=Template:10.04source&variant=zh-cn

 

#Archive.ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):

deb http://archive.ubuntu.com/ubuntu/ lucidmain restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/lucid-security main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/lucid-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ lucid-proposedmain restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/lucid-backports main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/lucid main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/lucid-security main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/lucid-updates main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/lucid-proposed main restricted universe multiverse

deb-src http://archive.ubuntu.com/ubuntu/lucid-backports main restricted universe multiverse

 

#骨头兄亲自搭建并维护这个Ubuntu源(该源位于浙江杭州百兆共享宽带的电信机房):

deb http://ubuntu.srt.cn/ubuntu/ lucid mainrestricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/lucid-security main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/lucid-updates main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/lucid-proposed main restricted universe multiverse

deb http://ubuntu.srt.cn/ubuntu/lucid-backports main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/ lucidmain restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/lucid-security main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/lucid-updates main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/lucid-proposed main restricted universe multiverse

deb-src http://ubuntu.srt.cn/ubuntu/lucid-backports main restricted universe multiverse

 

#网易163更新服务器:

deb http://mirrors.163.com/ubuntu/ lucidmain restricted universe multiverse

deb http://mirrors.163.com/ubuntu/lucid-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/lucid-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/lucid-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/lucid-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/lucid main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/lucid-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/lucid-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/lucid-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/lucid-backports main restricted universe multiverse

 

#sohu 更新服务器:

deb http://mirrors.sohu.com/ubuntu/ lucidmain restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/lucid-security main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/lucid-updates main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/lucid-proposed main restricted universe multiverse

deb http://mirrors.sohu.com/ubuntu/lucid-backports main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/lucid main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/lucid-security main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/lucid-updates main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/lucid-proposed main restricted universe multiverse

deb-src http://mirrors.sohu.com/ubuntu/lucid-backports main restricted universe multiverse

 

#Mirrors.shlug.org更新服务器(电信服务器,UbuntuChina Official Mirror, maintained by Shanghai Linux User Group):

deb http://cn.archive.ubuntu.com/ubuntulucid main restricted universe multiverse

deb http://cn.archive.ubuntu.com/ubuntulucid-security main restricted universe multiverse

deb http://cn.archive.ubuntu.com/ubuntu lucid-updatesmain restricted universe multiverse

deb http://cn.archive.ubuntu.com/ubuntulucid-backports main restricted universe multiverse

deb http://cn.archive.ubuntu.com/ubuntulucid-proposed main restricted universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntulucid main restricted universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntulucid-security main restricted universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntulucid-updates main restricted universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntulucid-backports main restricted universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntulucid-proposed main restricted universe multiverse

 

#Mirror.lupaworld.com更新服务器(浙江省杭州市双线服务器):

deb http://mirror.lupaworld.com/ubuntulucid main restricted universe multiverse

deb http://mirror.lupaworld.com/ubuntulucid-security main restricted universe multiverse

deb http://mirror.lupaworld.com/ubuntulucid-updates main restricted universe multiverse

deb http://mirror.lupaworld.com/ubuntulucid-backports main restricted universe multiverse

deb http://mirror.lupaworld.com/ubuntulucid-proposed main restricted universe multiverse

deb-src http://mirror.lupaworld.com/ubuntulucid main restricted universe multiverse

deb-src http://mirror.lupaworld.com/ubuntulucid-security main restricted universe multiverse

deb-src http://mirror.lupaworld.com/ubuntulucid-updates main restricted universe multiverse

deb-src http://mirror.lupaworld.com/ubuntulucid-backports main restricted universe multiverse

deb-src http://mirror.lupaworld.com/ubuntulucid-proposed main restricted universe multiverse

 

#厦门大学更新服务器(教育网服务器):

deb ftp://ubuntu.realss.cn/ubuntu/ lucidmain restricted universe multiverse

deb ftp://ubuntu.realss.cn/ubuntu/lucid-backports restricted universe multiverse

deb ftp://ubuntu.realss.cn/ubuntu/lucid-proposed main restricted universe multiverse

deb ftp://ubuntu.realss.cn/ubuntu/lucid-security main restricted universe multiverse

deb ftp://ubuntu.realss.cn/ubuntu/lucid-updates main restricted universe multiverse

deb-src ftp://ubuntu.realss.cn/ubuntu/lucid main restricted universe multiverse

deb-src ftp://ubuntu.realss.cn/ubuntu/lucid-backports main restricted universe multiverse

deb-src ftp://ubuntu.realss.cn/ubuntu/lucid-proposed main restricted universe multiverse

deb-src ftp://ubuntu.realss.cn/ubuntu/lucid-security main restricted universe multiverse

deb-src ftp://ubuntu.realss.cn/ubuntu/lucid-updates main restricted universe multiverse

 

#成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):

deb http://ubuntu.uestc.edu.cn/ubuntu/lucid main multiverse restricted universe

deb http://ubuntu.uestc.edu.cn/ubuntu/lucid-backports main multiverse restricted universe

deb http://ubuntu.uestc.edu.cn/ubuntu/lucid-proposed main multiverse restricted universe

deb http://ubuntu.uestc.edu.cn/ubuntu/lucid-security main multiverse restricted universe

deb http://ubuntu.uestc.edu.cn/ubuntu/lucid-updates main multiverse restricted universe

deb-src http://ubuntu.uestc.edu.cn/ubuntu/lucid main multiverse restricted universe

deb-src http://ubuntu.uestc.edu.cn/ubuntu/lucid-backports main multiverse restricted universe

deb-src http://ubuntu.uestc.edu.cn/ubuntu/lucid-proposed main multiverse restricted universe

deb-src http://ubuntu.uestc.edu.cn/ubuntu/lucid-security main multiverse restricted universe

deb-src http://ubuntu.uestc.edu.cn/ubuntu/lucid-updates main multiverse restricted universe

 

# == 如果无法解析uestc.edu.cn域名,请使用以下地址 ==

 

deb http://ubuntu.dormforce.net/ubuntu/lucid main multiverse restricted universe

deb http://ubuntu.dormforce.net/ubuntu/lucid-backports main multiverse restricted universe

deb http://ubuntu.dormforce.net/ubuntu/lucid-proposed main multiverse restricted universe

deb http://ubuntu.dormforce.net/ubuntu/lucid-security main multiverse restricted universe

deb http://ubuntu.dormforce.net/ubuntu/lucid-updates main multiverse restricted universe

deb-src http://ubuntu.dormforce.net/ubuntu/lucid main multiverse restricted universe

deb-src http://ubuntu.dormforce.net/ubuntu/lucid-backports main multiverse restricted universe

deb-src http://ubuntu.dormforce.net/ubuntu/lucid-proposed main multiverse restricted universe

deb-src http://ubuntu.dormforce.net/ubuntu/lucid-security main multiverse restricted universe

deb-src http://ubuntu.dormforce.net/ubuntu/lucid-updates main multiverse restricted universe

 

#上海市上海交通大学更新服务器:

deb http://ftp.sjtu.edu.cn/ubuntu/ lucidmain multiverse restricted universe

deb http://ftp.sjtu.edu.cn/ubuntu/lucid-backports main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/ubuntu/lucid-proposed main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/ubuntu/lucid-security main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/ubuntu/lucid-updates main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/ubuntu/lucid main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/ubuntu/lucid-backports main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/ubuntu/lucid-proposed main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/ubuntu/lucid-security main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/ubuntu/lucid-updates main multiverse restricted universe

 

#中国科学技术大学更新服务器:

deb http://debian.ustc.edu.cn/ubuntu/ lucidmain multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/lucid-backports main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/lucid-proposed main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/lucid-security main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/lucid-updates main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/lucid main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/lucid-backports main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/lucid-proposed main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/lucid-security main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/lucid-updates main multiverse restricted universe

 

#中国地质大学(北京)更新服务器:

deb http://www.tofree.org/ubuntu/ lucidmain restricted universe multiverse

deb http://www.tofree.org/ubuntu/lucid-security main restricted universe multiverse

deb http://www.tofree.org/ubuntu/lucid-updates main restricted universe multiverse

deb http://www.tofree.org/ubuntu/ lucid-proposedmain restricted universe multiverse

deb http://www.tofree.org/ubuntu/lucid-backports main restricted universe multiverse

deb-src http://www.tofree.org/ubuntu/ lucidmain restricted universe multiverse

deb-src http://www.tofree.org/ubuntu/lucid-security main restricted universe multiverse

deb-src http://www.tofree.org/ubuntu/lucid-updates main restricted universe multiverse

deb-src http://www.tofree.org/ubuntu/lucid-proposed main restricted universe multiverse

deb-src http://www.tofree.org/ubuntu/lucid-backports main restricted universe multiverse

 

#中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/lucid main restricted universe multiverse

deb-srchttp://ubuntu.csie.ntu.edu.tw/ubuntu/ lucid main restricted universe multiverse

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/lucid-updates main restricted universe multiverse

deb-srchttp://ubuntu.csie.ntu.edu.tw/ubuntu/ lucid-updates main restricted universemultiverse

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/lucid-backports main restricted universe multiverse

deb-srchttp://ubuntu.csie.ntu.edu.tw/ubuntu/ lucid-backports main restricted universemultiverse

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/lucid-security main restricted universe multiverse

deb-srchttp://ubuntu.csie.ntu.edu.tw/ubuntu/ lucid-security main restricted universemultiverse

deb http://ubuntu.csie.ntu.edu.tw/ubuntu/lucid-proposed main multiverse restricted universe

deb-srchttp://ubuntu.csie.ntu.edu.tw/ubuntu/ lucid-proposed main restricted universemultiverse

 

#mirror.rootguide.org更新服务器(上海市 电信):

deb http://mirror.rootguide.org/ubuntu/lucid main restricted universe multiverse

deb-src http://mirror.rootguide.org/ubuntu/lucid main restricted universe multiverse

deb http://mirror.rootguide.org/ubuntu/lucid-updates main restricted universe multiverse

deb-src http://mirror.rootguide.org/ubuntu/lucid-updates main restricted universe multiverse

deb http://mirror.rootguide.org/ubuntu/lucid-backports main restricted universe multiverse

deb-src http://mirror.rootguide.org/ubuntu/lucid-backports main restricted universe multiverse

deb http://mirror.rootguide.org/ubuntu/lucid-security main restricted universe multiverse

deb-src http://mirror.rootguide.org/ubuntu/lucid-security main restricted universe multiverse

deb http://mirror.rootguide.org/ubuntu/lucid-proposed main multiverse restricted universe

deb-src http://mirror.rootguide.org/ubuntu/lucid-proposed main restricted universe multiverse

 

#台湾的官方源速度也相当不错,有时甚至快于内地的:

deb http://tw.archive.ubuntu.com/ubuntulucid main restricted universe multiverse

deb http://tw.archive.ubuntu.com/ubuntulucid-security main restricted universe multiverse

deb http://tw.archive.ubuntu.com/ubuntulucid-updates main restricted universe multiverse

deb http://tw.archive.ubuntu.com/ubuntulucid-backports main restricted universe multiverse

deb http://tw.archive.ubuntu.com/ubuntulucid-proposed main restricted universe multiverse

deb-src http://tw.archive.ubuntu.com/ubuntulucid main restricted universe multiverse

deb-src http://tw.archive.ubuntu.com/ubuntulucid-security main restricted universe multiverse

deb-src http://tw.archive.ubuntu.com/ubuntulucid-updates main restricted universe multiverse

deb-src http://tw.archive.ubuntu.com/ubuntulucid-backports main restricted universe multiverse

deb-src http://tw.archive.ubuntu.com/ubuntulucid-proposed main restricted universe multiverse

 

#以下源支持IPV6,推荐可以使用IPV6的教育网用户使用,速度在200kb/s左右,如需源代码,将deb替换成deb-src即可

deb http://mirror.switch.ch/ftp/ubuntu/lucid main multiverse restricted universe

deb http://mirror.switch.ch/ftp/ubuntu/lucid-backports main multiverse restricted universe

deb http://mirror.switch.ch/ftp/ubuntu/lucid-proposed main multiverse restricted universe

deb http://mirror.switch.ch/ftp/ubuntu/lucid-security main multiverse restricted universe

deb http://mirror.switch.ch/ftp/ubuntu/lucid-updates main multiverse restricted universe

 

deb http://ftp.heanet.ie/mirrors/ubuntu/lucid main multiverse restricted universe

deb http://ftp.heanet.ie/mirrors/ubuntu/lucid-backports main multiverse restricted universe

deb http://ftp.heanet.ie/mirrors/ubuntu/lucid-proposed main multiverse restricted universe

deb http://ftp.heanet.ie/mirrors/ubuntu/lucid-security main multiverse restricted universe

deb http://ftp.heanet.ie/mirrors/ubuntu/lucid-updates main multiverse restricted universe

 

debhttp://ftp.kddlabs.co.jp/020/Linux/packages/ubuntu/archive/ lucid mainmultiverse restricted universe

deb http://ftp.kddlabs.co.jp/020/Linux/packages/ubuntu/archive/lucid-backports main multiverse restricted universe

debhttp://ftp.kddlabs.co.jp/020/Linux/packages/ubuntu/archive/ lucid-proposed mainmultiverse restricted universe

debhttp://ftp.kddlabs.co.jp/020/Linux/packages/ubuntu/archive/ lucid-security mainmultiverse restricted universe

debhttp://ftp.kddlabs.co.jp/020/Linux/packages/ubuntu/archive/ lucid-updates mainmultiverse restricted universe

 

二、更改Root账户

注:此操作不执行也是可以的。

 

1、重置root密码:

利用现有管理员帐户登陆Ubuntu,在终端执行命令:sudopasswd root,接着输入密码和root密码,重复密码。这时候root用户已经设定了新的密码

2、允许以root用户登录:

默认情况是不允许用root帐号直接登陆图形界面的。这可以通过修改/etc/gdm/gdm.conf文件来允许root直接登陆,在该文件中找到 AllowRoot=false 将其改为 AllowRoot=true 切换用户就可以了。

注:gdm.conf默认是只读属性,修改前请先使用sudo chmod 777 /etc/gdm/gdm.conf 将文件权限设置为为777。

 

三、安装必要的库和包

1、Linux 32位:

官方推荐安装的包:

sudo apt-get install git-core gnupg flex bison gperf libsdl-devlibesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

         其中官方推荐的还有sun-java5-jdk ,此包将在下一节详细介绍。

         此外,还可以安装Valgrind 工具,它可以帮助你找到内存泄露,堆栈溢出和数组越界等问题:

                   sudoapt-get install valgrind

2、Linux 64

如果是64位的操作系统,除了32位系统所需的包之外,还需要Piecesfrom the 32-bit cross-building environment和X11 development,全部命令如下:

                   sudoapt-get install git-core gnupg flex bison gperf build-essential zip curlzlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-devia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

         然后需要设置系统将正确的Java版本(1.5)设置为默认:(此内容将在下一节详细介绍)

                   sudoupdate-java-alternatives –s java-1.5.0-sun

         最后设置X11:Ubuntudoesn't have packages for the X11 libraries, but that can be worked around withthe following command:

sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so

3、另外,如果在编译过程中发现某些命令找不到,就apt-get它。可能还会需要的有:

sudo apt-getinstall libc6-dev

sudo apt-getinstall patch

sudo apt-getinstall texinfo

sudo apt-getinstall zlib1g-dev

sudo apt-getinstall valgrind

 

四、安装和配置JDK 1.5

         Android2.2的官方文档中说可以使用JDK 1.6来编译,据说使用JDK1.6编译时会出现Make Doc错误,所以最好还是使用JDK 1.5来编译,至于用JDK1.6来编译,我没有试过。

 

1、 安装 JDK 1.5

有两种方法,一是apt-get安装,二是使用安装包来手动安装,分别介绍如下:

apt-get安装:

由于Ubuntu10.04中已经没有了JDK 1.5的源,所以,先备份一下源列表:

           sudo cp/etc/apt/sources.list /etc/apt/sources.list.backup

然后把下面的地址添加到/etc/apt/sources.list 中:

                            debhttp://cn.archive.ubuntu.com/ubuntu/ jaunty multiverse

deb http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse

 

或者如下源:

deb http://mirror.osqdu.org.cn/ubuntu jaunty main restrictedmultiverse universe

deb http://mirror.osqdu.org.cn/ubuntu jaunty-updates main restricteduniverse multiverse

deb http://mirror.osqdu.org.cn/ubuntu jaunty-security main restricteduniverse multiverse

deb http://mirror.osqdu.org.cn/ubuntu jaunty-proposed mainrestricted universe multiverse 

 

更多的源列表:

#Archive.Ubuntu.com更新服务器(欧洲,此为官方源,电信网通用户使用):

 

deb http://archive.Ubuntu.com/ubuntu/ jaunty main restricted universe multiverse

deb http://archive.Ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse

deb http://archive.Ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse

deb http://archive.Ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse

deb http://archive.Ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse

deb-src http://archive.Ubuntu.com/ubuntu/ jaunty main restricted universe multiverse

deb-src http://archive.Ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse

deb-src http://archive.Ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse

deb-src http://archive.Ubuntu.com/ubuntu/ jaunty-proposed main restricted universe multiverse

deb-src http://archive.Ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse

 

#网易163更新服务器:

 

deb http://mirrors.163.com/Ubuntu/ jaunty main restricted universe multiverse

deb http://mirrors.163.com/Ubuntu/ jaunty-security main restricted universe multiverse

deb http://mirrors.163.com/Ubuntu/ jaunty-updates main restricted universe multiverse

deb http://mirrors.163.com/Ubuntu/ jaunty-proposed main restricted universe multiverse

deb http://mirrors.163.com/Ubuntu/ jaunty-backports main restricted universe multiverse

deb-src http://mirrors.163.com/Ubuntu/ jaunty main restricted universe multiverse

deb-src http://mirrors.163.com/Ubuntu/ jaunty-security main restricted universe multiverse

deb-src http://mirrors.163.com/Ubuntu/ jaunty-updates main restricted universe multiverse

deb-src http://mirrors.163.com/Ubuntu/ jaunty-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/Ubuntu/ jaunty-backports main restricted universe multiverse

 

#Mirrors.shlug.org更新服务器(电信服务器,Ubuntu China Official Mirror, maintained by Shanghai Linux User Group):

 

deb http://cn.archive.Ubuntu.com/ubuntu jaunty main restricted universe multiverse

deb http://cn.archive.Ubuntu.com/ubuntu jaunty-security main restricted universe multiverse

deb http://cn.archive.Ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse

deb http://cn.archive.Ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse

deb http://cn.archive.Ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse

deb-src http://cn.archive.Ubuntu.com/ubuntu jaunty main restricted universe multiverse

deb-src http://cn.archive.Ubuntu.com/ubuntu jaunty-security main restricted universe multiverse

deb-src http://cn.archive.Ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse

deb-src http://cn.archive.Ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse

deb-src http://cn.archive.Ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse

 

#Mirror.lupaworld.com更新服务器(浙江省杭州市双线服务器,推荐):

 

deb http://mirror.lupaworld.com/Ubuntu jaunty main restricted universe multiverse

deb http://mirror.lupaworld.com/Ubuntu jaunty-security main restricted universe multiverse

deb http://mirror.lupaworld.com/Ubuntu jaunty-updates main restricted universe multiverse

deb http://mirror.lupaworld.com/Ubuntu jaunty-backports main restricted universe multiverse

deb http://mirror.lupaworld.com/Ubuntu jaunty-proposed main restricted universe multiverse

deb-src http://mirror.lupaworld.com/Ubuntu jaunty main restricted universe multiverse

deb-src http://mirror.lupaworld.com/Ubuntu jaunty-security main restricted universe multiverse

deb-src http://mirror.lupaworld.com/Ubuntu jaunty-updates main restricted universe multiverse

deb-src http://mirror.lupaworld.com/Ubuntu jaunty-backports main restricted universe multiverse

deb-src http://mirror.lupaworld.com/Ubuntu jaunty-proposed main restricted universe multiverse

 

#厦门大学更新服务器(教育网服务器):

 

deb ftp://Ubuntu.realss.cn/ubuntu/ jaunty main restricted universe multiverse

deb ftp://Ubuntu.realss.cn/ubuntu/ jaunty-backports restricted universe multiverse

deb ftp://Ubuntu.realss.cn/ubuntu/ jaunty-proposed main restricted universe multiverse

deb ftp://Ubuntu.realss.cn/ubuntu/ jaunty-security main restricted universe multiverse

deb ftp://Ubuntu.realss.cn/ubuntu/ jaunty-updates main restricted universe multiverse

deb-src ftp://Ubuntu.realss.cn/ubuntu/ jaunty main restricted universe multiverse

deb-src ftp://Ubuntu.realss.cn/ubuntu/ jaunty-backports main restricted universe multiverse

deb-src ftp://Ubuntu.realss.cn/ubuntu/ jaunty-proposed main restricted universe multiverse

deb-src ftp://Ubuntu.realss.cn/ubuntu/ jaunty-security main restricted universe multiverse

deb-src ftp://Ubuntu.realss.cn/ubuntu/ jaunty-updates main restricted universe multiverse

 

#成都市 电子科技大学更新服务器(教育网,推荐校园网和网通用户使用):

 

deb http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty main multiverse restricted universe

deb http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-backports main multiverse restricted universe

deb http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-proposed main multiverse restricted universe

deb http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-security main multiverse restricted universe

deb http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-updates main multiverse restricted universe

deb-src http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty main multiverse restricted universe

deb-src http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-backports main multiverse restricted universe

deb-src http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-proposed main multiverse restricted universe

deb-src http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-security main multiverse restricted universe

deb-src http://Ubuntu.uestc.edu.cn/ubuntu/ jaunty-updates main multiverse restricted universe

 

# == 如果无法解析uestc.edu.cn域名,请使用以下地址 ==

 

deb http://Ubuntu.dormforce.net/ubuntu/ jaunty main multiverse restricted universe

deb http://Ubuntu.dormforce.net/ubuntu/ jaunty-backports main multiverse restricted universe

deb http://Ubuntu.dormforce.net/ubuntu/ jaunty-proposed main multiverse restricted universe

deb http://Ubuntu.dormforce.net/ubuntu/ jaunty-security main multiverse restricted universe

deb http://Ubuntu.dormforce.net/ubuntu/ jaunty-updates main multiverse restricted universe

deb-src http://Ubuntu.dormforce.net/ubuntu/ jaunty main multiverse restricted universe

deb-src http://Ubuntu.dormforce.net/ubuntu/ jaunty-backports main multiverse restricted universe

deb-src http://Ubuntu.dormforce.net/ubuntu/ jaunty-proposed main multiverse restricted universe

deb-src http://Ubuntu.dormforce.net/ubuntu/ jaunty-security main multiverse restricted universe

deb-src http://Ubuntu.dormforce.net/ubuntu/ jaunty-updates main multiverse restricted universe

 

#上海市上海交通大学更新服务器(教育网,推荐校园网和网通用户使用):

 

deb http://ftp.sjtu.edu.cn/Ubuntu/ jaunty main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-backports main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-proposed main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-security main multiverse restricted universe

deb http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-updates main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/Ubuntu/ jaunty main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-backports main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-proposed main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-security main multiverse restricted universe

deb-src http://ftp.sjtu.edu.cn/Ubuntu/ jaunty-updates main multiverse restricted universe

 

#中国科学技术大学更新服务器(教育网,推荐校园网和网通用户使用):

 

deb http://debian.ustc.edu.cn/Ubuntu/ jaunty main multiverse restricted universe

deb http://debian.ustc.edu.cn/Ubuntu/ jaunty-backports main multiverse restricted universe

deb http://debian.ustc.edu.cn/Ubuntu/ jaunty-proposed main multiverse restricted universe

deb http://debian.ustc.edu.cn/Ubuntu/ jaunty-security main multiverse restricted universe

deb http://debian.ustc.edu.cn/Ubuntu/ jaunty-updates main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/Ubuntu/ jaunty main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/Ubuntu/ jaunty-backports main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/Ubuntu/ jaunty-proposed main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/Ubuntu/ jaunty-security main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/Ubuntu/ jaunty-updates main multiverse restricted universe

 

#中国台湾 台湾大学更新服务器(推荐网通用户使用,电信PING平均响应速度41MS。强烈推荐此源,比较完整,较少出现同步问题):

 

deb http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty main restricted universe multiverse

deb-src http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty main restricted universe multiverse

deb http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-updates main restricted universe multiverse

deb-src http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-updates main restricted universe multiverse

deb http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-backports main restricted universe multiverse

deb-src http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-backports main restricted universe multiverse

deb http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-security main restricted universe multiverse

deb-src http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-security main restricted universe multiverse

deb http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-proposed main multiverse restricted universe

deb-src http://Ubuntu.csie.ntu.edu.tw/ubuntu/ jaunty-proposed main restricted universe multiverse

 

#mirror.rootguide.org更新服务器(上海市 电信):

 

deb http://mirror.rootguide.org/Ubuntu/ jaunty main restricted universe multiverse

deb-src http://mirror.rootguide.org/Ubuntu/ jaunty main restricted universe multiverse

deb http://mirror.rootguide.org/Ubuntu/ jaunty-updates main restricted universe multiverse

deb-src http://mirror.rootguide.org/Ubuntu/ jaunty-updates main restricted universe multiverse

deb http://mirror.rootguide.org/Ubuntu/ jaunty-backports main restricted universe multiverse

deb-src http://mirror.rootguide.org/Ubuntu/ jaunty-backports main restricted universe multiverse

deb http://mirror.rootguide.org/Ubuntu/ jaunty-security main restricted universe multiverse

deb-src http://mirror.rootguide.org/Ubuntu/ jaunty-security main restricted universe multiverse

deb http://mirror.rootguide.org/Ubuntu/ jaunty-proposed main multiverse restricted universe

deb-src http://mirror.rootguide.org/Ubuntu/ jaunty-proposed main restricted universe multiverse

 

#台湾的官方源速度也相当不错,有时甚至快于内地的:

 

deb http://tw.archive.Ubuntu.com/ubuntu jaunty main restricted universe multiverse

deb http://tw.archive.Ubuntu.com/ubuntu jaunty-security main restricted universe multiverse

deb http://tw.archive.Ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse

deb http://tw.archive.Ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse

deb http://tw.archive.Ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse

deb-src http://tw.archive.Ubuntu.com/ubuntu jaunty main restricted universe multiverse

deb-src http://tw.archive.Ubuntu.com/ubuntu jaunty-security main restricted universe multiverse

deb-src http://tw.archive.Ubuntu.com/ubuntu jaunty-updates main restricted universe multiverse

deb-src http://tw.archive.Ubuntu.com/ubuntu jaunty-backports main restricted universe multiverse

deb-src http://tw.archive.Ubuntu.com/ubuntu jaunty-proposed main restricted universe multiverse

 

#安全更新:

#deb http://security.Ubuntu.com/ubuntu jaunty-security main restricted

#deb-src http://security.Ubuntu.com/ubuntu jaunty-security main restricted

#deb http://security.Ubuntu.com/ubuntu jaunty-security universe

#deb-src http://security.Ubuntu.com/ubuntu jaunty-security universe

#deb http://security.Ubuntu.com/ubuntu jaunty-security multiverse

#deb-src http://security.Ubuntu.com/ubuntu jaunty-security multiverse

 

 

#新增青岛大学源

 

#(对于运行9.04的用户 For users that running Ubuntu 9.04)

 

deb http://mirror.osqdu.org.cn/ubuntu jaunty main restricted multiverse universe

deb http://mirror.osqdu.org.cn/ubuntu jaunty-updates main restricted universe multiverse

deb http://mirror.osqdu.org.cn/ubuntu jaunty-security main restricted universe multiverse

deb http://mirror.osqdu.org.cn/ubuntu jaunty-proposed main restricted universe multiverse

 

#(对于运行9.10的用户 For users that running Ubuntu 9.10)

 

deb http://mirror.osqdu.org.cn/ubuntu karmic main restricted multiverse universe

deb http://mirror.osqdu.org.cn/ubuntu karmic-updates main restricted universe multiverse

deb http://mirror.osqdu.org.cn/ubuntu karmic-security main restricted universe multiverse

deb http://mirror.osqdu.org.cn/ubuntu karmic-proposed main restricted universe multiverse

然后再 sudoapt-get update,

然后再执行 sudoapt-get install sun-java5-jdk。

使用安装包手动安装:

将jdk-6u20-linux-i586.bin复制到/usr/lib/jvm/java文件夹下,如果文件夹不存在,刚新建此文件夹:

执行:sudo chmoda+x jdk-1_5_0_22-linux-amd64.bin

执行:sudo ./jdk-1_5_0_22-linux-amd64.bin

连续按回车直到显示要求输入yes/no,此时输入yes并回车,将会得到jdk1.5.0_22目录。

此时JDK安装完毕。

在终端执行代码:sudogedit /etc/environment 或者 gedit ~/.bashrc,添加如下变量:

JAVA_HOME=/usr/lib/jvm/java/jdk1.5.0_22

JRE_HOME=${JAVA_HOME}/jre

export ANDROID_JAVA_HOME=$JAVA_HOME

export CLASSPATH=.:${JAVA_HOME}/lib:$JRE_HOME/lib:$CLASSPATH

export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin

export JAVA_HOME

export JRE_HOME

export CLASSPATH

HOME_BIN=~/bin/

export ANDROID_PRODUCT_OUT=~/android/out/target/product/generic

ANDROID_PRODUCT_OUT_BIN=~/android/android-sdk-linux_86/tools

export PATH=${PATH}:${JAVA_PATH}:${HOME_BIN}:${ANDROID_PRODUCT_OUT_BIN}:${ANDROID_PRODUCT_OUT}

注:ANDROID_PRODUCT_OUT_BIN=~/android/android-sdk-linux_86/tools这一句,是因为我下载了SDK,而不是编译之后生成的,因为初次编译,怕有问题,所以借用了官方的SDK中的emulator来用的。此语句当然也可以忽略。

保存.bashrc文件后,要更新配置文件

         source ~/.bashrc

 

2、 设置默认的JDK

因为系统默认可能存在别的JDK,比如JDK 1.6,所以先在终端执行代码:

           java -version

           javac -version

         如果显示的Java和Javac版本是1.5的,刚无需进行下面的操作,否则要按下面的操作进行:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/jdk1.5.0_22/bin/java300

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/jdk1.5.0_22/bin/javac300

 

或者:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/jdk1.5.0_22/bin/java 50 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jvm/java/jdk1.5.0_22/man/man1/java.1

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/jdk1.5.0_22/bin/javac 50 --slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib/jvm/java/jdk1.5.0_22/man/man1/javac.1

 

接着执行:sudoupdate-alternatives --config java  ,选择对应的java

再执行:sudoupdate-alternatives --config javac ,选择对应的javac

 

输入java -version 和 javac –version,看是否分别都是1.5的JDK。如果是,刚成功安装和配置JDK1.5,否则可以先使用sudo update-alternatives --remove java/usr/lib/jvm/java/jdk1.5.0_22/bin/java 和 sudoupdate-alternatives --remove javac /usr/lib/jvm/java/jdk1.5.0_22/jre/bin/javac删除刚刚添加过的,然后再重新配置。

 

五、下载并编译Android源码

1、安装Repo

         创建~/bin目录,主要是用来存放repo程序,如下:

                   cd~

                   mkdirbin

将此路径添加到环境变量PATH中:

         gedit ~/.bashrc

如果有HOME_BIN=~/bin/ ,则不用再添加,否则要加上HOME_BIN=~/bin/,然后保存.bashrc文件后,要更新配置文件

source ~/.bashrc

下载repo脚本并使其可执行:

         curl http://android.git.kernel.org/repo>~/bin/repo

chmod a+x ~/bin/repo

2、初始化Repo

         mkdirandroid

         cdandroid

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

注:如果主干的源代码编译不成功,可以试试分支的源代码:

repo init -u git://android.git.kernel.org/platform/manifest.git -bandroid-2.2_r1

在此过程中需要输入名字和email地址。初始化成功后,会显示:

repo initialized in ~/android

在~/android下会有一个.repo的隐藏目录。

如果在此处出现 repo:commandnot found错误,则按如下方法解决:

         在 ~/.bashrc 中,将 export PATH=$PATH:$HOME/bin 添加到其中即可。

3、  同步源代码:

repo sync

4、  编译源代码:

cd ~/android

make –j3

注:这里的使用了-j3这个选项,j是选择电脑CPU的个数,如果是双核,那就是2+1,所以用-j3,具体情况自己来定。

 

在编译过程中,可能会出现如下错误:

l  错误1:

Install: out/host/linux-x86/framework/droiddoc.jar 

target Generated: libclearsilver-jni <= out/host/common/obj/JAVA_LIBRARIES/clearsilver_intermediates/javalib.jar

host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_util.c

In file included from /usr/include/features.h:378,

                 from /usr/include/string.h:26,

                 from external/clearsilver/java-jni/j_neo_util.c:1:

/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: 没有那个文件或目录

make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] 错误 1

解决办法是执行如下命令:

sudo apt-get install lib64z1-dev libc6-dev-amd64 g++-multiliblib64stdc++6

l  make若提示找不到-lncurses:则需要做以下链接:

ln –s /lib/libncurses.so.5 /lib/libncurses.so

 

l  编译版本错误:

You are attempting to build with the incorrect version of java.

Your version is: java version "1.6.0_17".

The correct version is: 1.5.

Please follow the machine setup instructions at http://source.android.com/download

出现此错误的原因是因为使用了JDK 1.6来编译Android,有两种解决办法,一是按上面介绍的,使用JDK 1.5来编译,另一种解决办法如下:

gedit ~/adroid/build/core/main.mk

修改

java_version := $(shell java -version 2>&1 | head -n 1 | grep'[ "]1\.5[\. "$$]')

javac_version := $(shell javac -version 2>&1 | head -n 1 |grep '[ "]1\.5[\. "$$]')

java_version := $(shell java -version 2>&1 | head -n 1 | grep'[ "]1\.6[\. "$$]')

javac_version := $(shell javac -version 2>&1 | head -n 1 |grep '[ "]1\.6[\. "$$]')

l  提示missing了“run-java-tool”错误:

解决方法:在make前设置环境变量ANDROID_JAVA_HOME到$JAVA_HOME,即在 ~/.bashrc 中添加 export ANDROID_JAVA_HOME=$JAVA_HOME 即可。

5、  在模拟器上运行编译好的Android

编译好android之后,/out/target/product/generic下会出现如下文件

android-info.txt

ramdisk.img

clean_steps.mk

install-files.txt

perivous_build_config.mk

system.img

userdata.img

我们运行emulator只需要ramdisk.img,system.img和userdata.img这三个文件。

由于之前我们已经下载官方的SDK包了,并且把路径添加到配置文件了,所以把三个文件复制到/android-sdk-linux_x86下即可,然后运行如下命令即可:

emulator -system system.img -data userdata.img -ramdisk ramdisk.img

或者:

emulator –image system.img -data userdata.img -ramdisk ramdisk.img

         或者将这三个img文件拷贝到 AndroidSDK 目录下的platforms/android-x(android版本)/images(如果images文件夹不存在则需要新建一个),然后再运行Android SDK目录下的tools/emulator即可,此方法为推荐的方法,在覆盖这三个img文件时,要记得备份原生的三个img

         如果没有下载过官方的SDK包,则按如下步骤进行操作:

                   在工作目录下,即~/android 下设置环境变量:

. build/envsetup.sh

partner_setup

emulator

或者在~/android/out/target/product/generic/ 目录下运行命令(此方法为推荐方法):

emulator -system system.img -data userdata.img -ramdisk ramdisk.img

或者:

emulator –image system.img -data userdata.img -ramdisk ramdisk.img

这时候Android模拟器的界面就出现了。

         如果还有错误,就做如下操作:

export  ANDROID_PRODUCT_OUT=~/android/out/target/product/generic

~/android/out/host/linux-x86/bin/emulator -image system.img -datauserdata.img -ramdisk ramdisk.img

 

6、  编译生成SDK

在工作目录下,即 ~/android 下,运行make sdk即可。

注意事项:

l  安装Java开发包的时候,不要安装sun-java6-jdk,要安装sun-java5-jdk避免出现make doc的错误。

l  直接使用源码中的某些应用作为基于编译后的SDK上的工程时,出现有些符号找不到的问题,按以下方法解决:

拿android.net.WebAddress类为例,在很多Google自带的应用中使用过,但是要是直接在编译后的SDK上拿来用,就发现此对象在SDK中找不到,解决办法就是,在其包的源码上的前几行的注释有{@hide}这个标识,删掉该行后进行编译所生成的SDK中就包含了android.net.WebAddress的对象。所以如果下面什么类找不到,就到类所在的源文件中重复以上修改即可。 即便按照以上操作,可能也会出现有的包找不到的情况,这种情况就例如包com.google.android.googleapps.IGoogleLoginService和com.google.android.googlelogin.GoogleLoginServiceConstants,解决方法就是在调用该类的工程程序中,包含以下外部的jar包:framework/opt/com.google.android/frame.jar和framework/opt/com.google.android.googlelogin/client.jar

六、在Eclipse中使用Android源代码

1、将编译好的Andorid源代码中的 .classpath 文件拷贝到Android源文件的根目录下:

         cd ~/android    # Enter the root of the android project

cpdevelopment/ide/eclipse/.classpath .       #Copy the .classpath file to the root of the android project

chmod u+w.classpath  # Make the copy writable

2、修改Eclipse程序的配置文件:

把eclipse.ini(在eclipse软件的安装目录下)的3个值改为下面的值:

-Xms128m

-Xmx512m

-XX:MaxPermSize=256m

3、将Android源代码导入到Eclipse中:

导入前先检查.classpath里的文件在Android源码中是否有相应的文件(文件夹),否则也会破坏Android源码(一般是多添加文件/文件夹),.classpath里多余的路径可删除。

         然后可在Eclipse中新建一个JavaProject,注意,一定要是Java Project而不能是Android Project!!!

         然后选择“Createproject from existing source”来导入Andorid源代码。

在导入代码的过程中,可能会碰到提示有重复项,需要编辑.classpath文件,搜索,会发现有两个是重复的,需要删掉其中一个。

android-formatting.xml、.classpath和android.importorder都放在development/ide/eclipse/下

android-formatting.xml用来配置eclipse编辑器的代码风格;android.importorder用来配置eclipse的import的顺序和结构。

在window->preferences->java->Codestyle->Formatter中导入android-formatting.xml

在window->preferences->java->Codestyle->OrganizeImports中导入android.importorder

 

可选安装anyedit插件:在http://andrei.gmxhome.de/anyedit/下载并导入eclipse中,以增强Eclipse的功能。

 

4、在Eclipse中编辑源代码:

         此处要注意,如果在将Android源代码导入到Eclipse中后,每次reposync之后,都要在Eclipse中刷新一下相应的文件/文件夹。

         如果要添加应用程序到Android源代码中,则要按以下步骤进行操作,以便新添加的应用程序可以被添加到Android的构建路径以以便编译:

l  Project Properties

l  Select "Java Build Path" from the left-hand menu.

l  Choose the "Source" tab.

l  Click "Add Folder...".

l  Add your app's "src" directory.

l  Click OK.

当按上述步骤完成后,在Eclipse的工程导航窗口中,新添加的应用程序所处的位置应该是:android/packages/apps/YourAppName/src。Depending on whichapp(s) you include, you may also need to include othersrc/main/java directoriesunder android/dalvik/libcore. Do this if you find you cannot build with thedefault set.

5、在Eclipse中调试Android源代码:

         首先启动模拟器:

                  cd ~/android    # enter the root of the android project

. build/envsetup.sh

lunch 1   # to build theemulator

make      # if you didn'talready do this

emulator  # you should see aGUI picture of a phone

         然后再启动DDMS:

                   cd~/android    # enter the root of theandroid project

                   ddms        # you should get a splufty debuggingconsole

注:以上是根据官方文档整理的,但是以我自己的实际经验来看,不用那么麻烦,只要启动Eclipse,然后打开DDMS视图就可以继续下面的操作。

然后在eclipse中配置调试类型和端口:

在 DDMS中选择想要调试的进程,用 phone进程为例,选中com.android.phone,然后在Eclipse的菜单栏中Run->DebugConfigurations->Remote Java Application -> New,设置”Host:”设为 localhost,”Port:”设为8700,”ConnectionType”为Standard(SocketAttach),然后再在代码中设置断点,就可以进行单步跟踪调试了。

7、  编译Android源代码中的程序:

在对源代码进行修改后,可以使用make进行完全编译,如果只是修改了源代码中的某一个应用程序,比如短信,则可以不用完全make整个Android源代码,以下是几种方法:

cd ~/android      #enter the root of the android project

. build/envsetup.sh

此时会多出m/mm/mmm等命令,m 编译整个 android 工程,mm 编译当前目录下的模块,mmmpath 编译指定目录下的模块。比如编译短信,有如下方法:

l  make Mms

l  make clean-Mms Mms

l  mmm packages/apps/Mms

转载于:https://www.cnblogs.com/jerrychoi/archive/2010/09/06/1819563.html

你可能感兴趣的:(与Android源代码编辑相关的一切操作介绍)