与Android源代码编辑相关的一切操作介绍
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