Debug with Android Emulator
来源:互联网 发布:京东金融网络拓扑 编辑:程序博客网 时间:2024/06/05 22:05
摘要
研究Android, 最好的方法莫过于Step by Step地Debug。本文记录了下载编译x86 emulator及Debug Java Frame和C++库的过程。以WebKit为例,介绍Android的调试过程。
代码下载
从Google下载源码,本文以Android 4.2.2 r1学习WebKit为例。如果你也和我一样从Google下载Android源码有困难,可以从这里下载
下载eclipse: >>>>
下载ADT, 需要和Android SDK对应,查看一下Android 4.2.2 r1的SDK需要的ADT版本是20.0.0
$ cat sdk/files/plugin.prop # begin plugin.propplugin.version=20.0.0http://dl.google.com/android/ADT-21.0.0.zip
编译之前
先解决两个编译bug: http://blog.csdn.net/telnetchen/article/details/17596181
加上调试所需要的编译选项
在这里加上framework的调试信息
frameworks/base/core/java/android/webkit/DebugFlags.java
拷贝build/buildspec.mk.default到根目录并且改名为buildspec.mk,加入以下内容:
DEBUG_MODULE_libwebcore:=trueDEBUG_MODULE_libxml2:=trueDEBUG_MODULE_libchromium_net := trueTARGET_CUSTOM_DEBUG_CFLAGS:=-O0 ADDITIONAL_BUILD_PROPERTIES += debug.db.uid=100000
查找所有模块:
确认以下的配置(false),以免出现文件过大的编译错误
external/webkit、Android.mk:LOCAL_PRELINK_MODULE := false
编译
source build/envsetup.shlunch full_x86-eng make sdk -jx
生成的SDK目录:out/host/linux-x86/sdk/android-sdk_eng.${USER}_linux-x86
安装ADT及指定SDK
打开Eclipse, Help -> Install New Software ...
安装完ADT后,Eclipse要求重启,启动起来会要求SDK
创建一个简单的WebKit应用并开始调试
Java部分可以在Eclipse中逐步跟踪,对于C++部分,还需要用gdb
Run the following command on your computer: adb forward tcp:5039 tcp:5039Run the following command on your running emulator: gdbserver 10.0.2.2:5039 attach pidRun the following commands in gdb:set solib-absolutep-refix out/target/product/generic_x86/symbolsset solib-search-path out/target/product/generic_x86/symbols/system/libfile out/target/product/generic_x86/symbols/system/app_process在某个地方设置一个break point,就可以用你喜欢的gdb了.
对于Java部分如果还提示找不到某个文件,可以让它去framework目录下继续找。
0 0
- Debug with Android Emulator
- Proxy with Android Emulator
- android logger with DEBUG switch
- How to debug test code on Windows Mobile Emulator with Visual Studio
- Android-Emulator
- Android emulator
- Android emulator
- Android Emulator
- Android-Emulator
- android jni debug native code with eclipse
- android debug command commonly with qcom chip
- 如何使用eclipse和emulator debug Android source code(JNI以上部分)
- 如何使用eclipse和emulator debug Android source code(JNI以上部分)
- Working with the Smartphone Emulator
- Managing Communications with the Emulator
- How to install Android SDK and play with Android 2.0 in the emulator
- android emulator( android模拟器)
- 【Android】Android Emulator初探
- 多种多样的高权重外链
- C语言scanf函数输入时键盘缓冲区\n的问题
- DecimalFormat的用法
- 特征方程法求解递推关系中的数列通项
- 用C#实现的条形码和二维码编码解码器
- Debug with Android Emulator
- 排序(3)冒泡排序
- Ubuntu 下配置 SSH服务全过程及问题解决
- SQL养成一个好习惯是一笔财富
- jquery api addback()和andSelf()
- Wireshark抓包中的TCP DUP ACK问题
- 深入解读ESB与SOA的关系
- C#--工作笔记(TextBox)
- 如何使用JSON Framework库解析与生成json数据(iphone网络篇二)