【发布时间】:2012-03-02 20:15:08
【问题描述】:
可以调试android框架的系统服务吗?
我遇到了这些链接,但未能成功调试系统服务。
【问题讨论】:
标签: android debugging service frameworks android-source
可以调试android框架的系统服务吗?
我遇到了这些链接,但未能成功调试系统服务。
【问题讨论】:
标签: android debugging service frameworks android-source
我找到并测试了 Android Studio here 的一些工作说明:
I choose API 17 because it doesn't have emulator rotate bug.
important steps:
0) make sure your android studio has downloaded sdk 17 with sources.
1) create any simple android project. make target sdk 17. min sdk 17 and compile with 17. build tools version doesn't matter. (File-> Project Structure-> app under Modules -> Flavor)
2) create emulator instance with api 17
3) open ddms, highlight system_process, that is it. (Tools -> Android - > Android Device Monitor)
4) for the simple project, config debug profiles: remote 8700, Run->Edit Configurations -> + -> Remote -> port 8700
5) from the simple project. launch debug with the profile. (now you will notice ddms's system_process has an special bug icon)
6) open file $(Android_Studio)/sdk/sources/android-17/com/android/server/am/ActivityStack.java in android studio, and then set a breakpoint at: realStartActivityLocked(…) func
7) IMPORTANT STEP: in android studio, from bottom pane, select Debugger -> Threads, WAIT threads are populated. because it means studio is connected with ddms now.
8) from emulator, launch any app/ or your simple app.
9) breakpoint will be intercepted, if not try restart the app in emulator again.
two refs:
http://apienthusiast.blogspot.com/2014/06/debugging-android-java-framework.html
http://source.android.com/source/using-eclipse.html
http://jmlinnik.blogspot.kr/2011/12/debug-built-in-applications-in-eclipse.html
https://software.intel.com/en-us/articles/android-system-level-javac-code-debugging
http://apienthusiast.blogspot.ca/2014/07/debugging-android-native-applications.html
【讨论】:
您需要一个能够调试 Android 框架服务的 eclipse 项目。为 AOSP 创建 Eclipse 项目的过程并不那么简单。 Android源站点上的说明留下了很多细节。您最终会得到损坏的项目或损坏的 AOSP 构建。如果您破坏了 AOSP 构建,您可能必须转到 eclipse 项目创建任何工件的每个文件夹并手动删除它们。
文章Debugging Android Java framework services 提供了从创建项目到使用该项目调试Android java 框架服务的分步教程。请检查该链接。
【讨论】:
可以调试android frameworks系统服务吗?
如果您正在编译和构建自己的固件,可以。请参阅the Using Eclipse page in the AOSP docs 上的“调试模拟器”部分。
【讨论】: