2012年3月5日 星期一

Debug 進入 Library Project 時出現 "Source Not Found" 無法逐行 Debug

事情原本是很簡單的,Activity Project 用了另一個 Library Project,然後 Debug 的時候如果 Breakpoint 在 Library 會出現 "Source Not Found" 的問題造成無法 Debug,這個問題也不是每個 Library Project 都會發生,照理說 Activity Project 使用 Library Project 後 Debug 應該要能找到 Library Project 的 Source,這個問題不應該發生的但是還是發生了 (囧),搞了 2 天最後終於 Google 到解決辦法,照做果然可以看到 Source 逐行 Debug。

有一點跟原始文章不太一樣的是最後的 "Select All" 我只有把要 Debug 的 Library Project 加進去就可以,沒必要把所有的 Project 加進去。


Unable to Debug Library Projects with ADT v14 - Source Not Found
Tried all of the above and it did not work for me, however the workaround detailed here did.
  1. Start debugging, and run until you hit a breakpoint (and precisely get a .class file instead of the .java you would like to have)
  2. Right click in the Debug view of the Debug perspective (for example on the call stack), and choose "Edit Source Lookup Path"
  3. Add all your projects above "Default", via "Add..." > "Java project" > "Select All"
(I'm using ADT 15.0.2 preview from http://tools.android.com/download)

沒有留言:

張貼留言