android - 如何调试android框架服务?

标签 android debugging service frameworks android-source

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

我遇到过这些链接,但还不够成功,无法调试系统服务。

http://android.opensourceror.org/2010/01/18/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 - 如何调试android框架服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9226451/

相关文章:

android - 在我的播放器中添加 Widevine DRM 支持

java - 本地PC服务器和android模拟器之间的Socket连接

iphone - 已发布的应用程序显示空白屏幕,但在调试器中不显示

c++ - GDB 调试器问题 - 没有命名的源文件

C# LdapConnection 身份验证问题

iphone - 有没有列出所有移动设备和规范的信息数据库?

android - 在android studio中升级数据库不起作用

c++ - 查找堆损坏

android - 如何确保您不会两次启动服务android

c# - 为什么我的 Windows C# 服务崩溃?