如何调试android框架服务?

pri*_*aul 6 debugging service android frameworks android-source

是否可以调试android框架的系统服务?

我遇到过这些链接,但没有成功调试系统服务.

http://android.opensourceror.org/2010/01/18/android-source/

Sam*_*Sam 5

我在这里找到并测试了Android Studio的一些工作说明:

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
Run Code Online (Sandbox Code Playgroud)


vid*_*guy 2

您需要一个 Eclipse 项目才能调试 Android 框架服务。为 AOSP 创建 Eclipse 项目的过程并不是那么简单。Android 源站点上的说明留下了很多细节。您最终会得到损坏的项目或损坏的 AOSP 构建。如果您破坏 AOSP 构建,您可能必须转到 Eclipse 项目创建任何工件的每个文件夹并手动删除它们。

调试 Android Java 框架服务一文提供了从创建项目到使用该项目调试 Android java 框架服务的分步教程。请检查该链接。