使用 IntelliJ Debug Android 源码
2017-02-25 本文已影响1534人
crianzy
Android 源码系列文章:
Mac 10.12 快速下载 Android 源码
Mac 10.12 编译 Android 源码
使用 IntelliJ 查看 Android 源码
使用 IntelliJ Debug Android 源码
这里需要用到 Java 远程 Debug 的相关知识, 其实我们使用 Android Studio 使用的也是远程 debug .
相关参考https://www.jetbrains.com/help/idea/2016.3/run-debug-configuration-remote.html
配置 IntelliJ remote debug
按照下图进入 RunDebug 配置界面, 并新增一个 remote 配置, 且端口设为 8700


打开 monitor 选择 debug 进程
monitor 位于 Android sdk tools 目录下, 通过termianl 打开它

打开后可以看到手机当前的进程:

我们选中我们要调试的进程, 鼠标点击即可.(如上图中的 com.android.settings)
开始 debug
然后回到 Intellij 打好断点并 点击 debug

如果弹出如下界面, 说明 debug 成功了

然后触发到断点, 顺利进入 熟悉的 debug 界面

自此在 Mac 上 下载, 编译, 查看, debug Android 源码的流程结束了, 希望各位看官有所收获