Building, running, and debugging Android source
来源:互联网 发布:播放视频的软件 编辑:程序博客网 时间:2024/05/17 23:37
http://blog.sina.com.cn/s/blog_593aa8dd0100d0f5.html
在eclipse里,查看windows-->perference-->android-->ddms,记住端口号
右键debug framework source project,写入端口号,即debug scuess.
There is a lot of confusion surrounding the work flow in the Android source tree, so allow me to simplify:
- Follow the initial instructions for downloading the source at:
http://source.android.com/download - Setup your environment to build the engineering build for the genericdevice and generic product. This is similar to the SDK, but with a fewpieces missing.
$ source build/envsetup.sh
$ lunch 1 - To build for the first time:
$ make
If you have a multi-core system, you can build withmake -jN
where N is twice the number of cores on your machine. This should speed up the first build considerably. - To launch the emulator from your build:
$ ./out/host/<your-machine-type>/bin/emulator
On my system<your-machine-type>
islinux-x86
.
NOTE: The emulator knows where to find system and data images as a result of runninglunch 1
above. This sets the environment variableANDROID_PRODUCT_OUT
to point to the target directory. For this example, it should beout/target/product/generic/
. - If you wish to make changes to the source code, there are handy utilities that have been exposed to your environment by
source build/envsetup.sh
above. For example, if you modify the Email app and just want to rebuild it:$ mmm packages/apps/Email
- To see your changes in the emulator you can run:
$ adb remount
$ adb sync
Which will copy the regeneratedEmail.apk
file into the emulator's/system/app
folder, triggering thePackageManager
to automatically reinstall it. - Or if you change framework resources in
frameworks/base/core/res/res/
you could regenerateframework-res.apk
with:$ mmm frameworks/base/core/res
Or if you modified even the framework itself you could run:$ mmm frameworks/base
To sync these changes you must restart the running framework and sync, as with this handy sequence:$ adb remount
$ adb shell stop
$ adb sync
$ adb shell start - Finally,to debug your changes you can use the DDMS tool to select a process fordebug and then attach Eclipse to it. If you have the Eclipse AndroidDevelopment plugin installed, there is a special DDMS perspective whichyou can use to choose the process for debug. To attach Eclipse to it,see these instructions:
http://source.android.com/using-eclipse
Thisdocument also describes how to use Eclipse for development. Any IDEshould work with the proper finagling though. Just note that the IDEwon't really be an integrated environment: the final output of APKs,system.img
, and even the generation ofR.java
files will have to be done bymake
!
A note about the processes in Android:system_process
houses all things underframeworks/base/services
.This includes the PackageManagerService, StatusBarService, etc. It hasmany, many threads (one for each service, and then one main UI thread),so be wary when debugging.com.android.acore
hosts Launcher (home), Contacts, etc. You can determine the apps/providers that run here by looking forandroid:process="android.process.acore"
in the variousAndroidManifest.xml
files in packages/.
Also remember that the "framework" (underframeworks/base/core/java
)is not hosted by any one process. It is a library used by mostprocesses, so to debug code there you can usually use a simple demo appthat takes advantage of whatever you changed and debug that app'sprocess. A useful trick for setting up your debug connection is to callDebug.waitForDebugger()
during some startup part of an application or system service.
UPDATE 2009-07-24: The original ONE_SHOT_MAKEFILE
line I gave for rebuilding the framework has been deprecated. mmm frameworks/base
is now the recommended way to rebuild the framework code.
- Building, running, and debugging Android source
- Running emulator after building Android from source
- running and debugging xv6
- Building and running Node.js for Android
- Building and running Node.js for Android
- Building and Running
- Building and Running Modules
- Running and Debugging MEL commands
- Building and Running Overview(官方)
- Android for MSM Project,Downloading and Building from Source
- Building and Running a Web Application
- Getting Started: Building and Running Clang
- Linux Device Drivers 3rd Edition Building and Running
- Problems when building and running Nutch in eclipse
- Building and running MySQL as a local (non-root) user
- Writing, Building, and Running Chaincode in a Development Environment
- Debugging a Running Process
- Building Android Source code with Ubuntu 10.04
- Android核心分析 之一--------分析方法论探讨之设计意图
- 指针函数
- WebBrowser拦截网页Alter消息
- WPF 三维学习笔记
- Shadow Maping
- Building, running, and debugging Android source
- AudioFlinger向下访问AudioHardware,实现输出音频数据,控制音频参数
- 工作半年总结
- bdb及其在php下扩展的安装
- bdb及其在php下扩展的安装
- CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
- IE7以后无法用JS去掉IE窗口的标题栏,地址栏
- 总结一下qsort()函数的使用与注意
- Extjs Ext.form.ComboBox() 控件分页