2012-02-10 53 views

回答

2

您需要一個eclipse項目才能夠調試Android框架服務。爲AOSP創建eclipse項目的過程並不是那麼簡單。 Android源網站上的說明留下了很多細節。您將最終破裂的項目或損壞的AOSP構建。如果你打破AOSP構建,你可能不得不去每個eclipse項目創建任何工件的文件夾並手動刪除它們。

文章Debugging Android Java framework services提供了一步一步的教程,從創建項目到使用該項目調試Android Java框架服務。請檢查該鏈接。

1

是否有可能調試Android的框架系統服務?

如果您正在編譯和構建自己的固件,是的。請參閱the Using Eclipse page in the AOSP docs上的「調試仿真器」部分。

+0

感謝您的回覆。我在做一個設備調試。我想調試在\ packages \ apps \ Launcher2 \中找到的launcher2應用程序。這使用在frameworks \ base \ services \ java \ com \ android \ server中找到的系統服務WallpaperManagerService。所以現在,我無法將此文件夾導入到Eclipse中,並調試WallpaperManagerService中的代碼。你有什麼建議將代碼導入eclipse並從那裏調試嗎?謝謝,Priju – prijupaul 2012-02-13 07:11:40

5

我發現和測試了一些工作的指示爲Android工作室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