Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android debugging

 
Giovanni Montano
Ranch Hand
Posts: 250
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Developers,
when I need to understand how a program work, I put inside the program a lot of Log.d so that I can see, the direction, the flux( I do not know the term), the ORDER how the instruction in the code are executed once is launched,
it is a really long process, so i was wondering, it is possible that there is not a tool I can use to see the order the instruction in the program are executed, so that I can understand how a program works. In other words, I cannot find in internet an eclipse functionality or add in tool that can show me more o less sequentially what instruction is called( the order the program is written is different by the one it is executed so from the main on create to an interface, then back, then another class, then a method back in the main class again etc)
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse does support Android debugging (http://code.tutsplus.com/tutorials/android-app-debugging--mobile-12563), as does Android Studio (https://developer.android.com/sdk/installing/studio-debug.html).
 
Giovanni Montano
Ranch Hand
Posts: 250
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Eclipse does support Android debugging (http://code.tutsplus.com/tutorials/android-app-debugging--mobile-12563), as does Android Studio (https://developer.android.com/sdk/installing/studio-debug.html).

Thank you Ulf, it was really a newbe question, I did not think about writing debugging in my engine search.
it was a really easy one, I apologize.
 
Giovanni Montano
Ranch Hand
Posts: 250
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Eclipse does support Android debugging (http://code.tutsplus.com/tutorials/android-app-debugging--mobile-12563), as does Android Studio (https://developer.android.com/sdk/installing/studio-debug.html).

Dear Ulf,
I went through your recommendation, and I discovered this new world of the debugging,
but still I cannot see clearly the order the compiler execute the code: after different days of reading tutorials and trying, still I cannot see the code flux. I tried to set breakpoints everywhere, on every method( selecting them from outline view) but step into does not work( open a source not found windows) and step over, sometimes yes and other times not. Maybe this is not the place where I should ask about Eclipse functionalities, but still I am surprised that is so hard to see the order how the compiler execute commands

have a nice day
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not used Eclipse, but stepping through code is such a basic debugging feature that it would surprise me if it doesn't work correctly. Make sure that the source code for all libraries you want to debug is attached to the project, and that libraries are compiled for debugging (otherwise required information is missing from the class files).
 
Giovanni Montano
Ranch Hand
Posts: 250
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:I have not used Eclipse, but stepping through code is such a basic debugging feature that it would surprise me if it doesn't work correctly. Make sure that the source code for all libraries you want to debug is attached to the project, and that libraries are compiled for debugging (otherwise required information is missing from the class files).

Thank you Ulf, i will study another tutorial from Vogella, I will insist with debugging, and also thank you to tell me "stepping through code" that was the K word I want to give to eat to google.
happy coding!
 
Giovanni Montano
Ranch Hand
Posts: 250
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Ulff,
thank you for the patience

Now are several days I am busy with debugging with Android. Two points to develop.
Unfortunately despite my huge progress I discovered I cannot see the flux if an interface is called, because the "breakpoints" cannot be applied to interfaces, and Api classes es if I want to see a shared preference method I am calling importing the libraries, I cannot do it.

1)First of all I use the debugger to step through the flux of programs I do not know. Please... what is the order the breakpoints appear? I do not understand if I have to select a couple of them, of all the methods, in fact if I select all the method it looks like the program starts not from OnCreate, but for the last break point i selected! this makes impossible to see the flux of code like with the great Log.d that is time consuming if I need to examine all the code, in fact I am still wondering why there is not a tool that add log.d numerated and with the print of the line they refer, so that one can see from the Log DDMS the exact sequence the code is running ( i would do but reflection is too advanced for me at the moment). I finstead I select only a couple of break points I can see better the flux, but I miss the big picture. any tip to see the flux in an easy way, or if the automatic Log.d project has been already implemented by someone? thanks and sorry maybe I am OT for Android, as could be a more an Eclipse IDE issue.



2) Second I would like to change the post to "Debugging in Android with Eclipse: if Debugger does not work" to give benefit to future searches by users with similar issues, because I went through a lot of setting problems, the more important solutions are the following:
a) changing the ADB connection timeout. Ifrom 5000ms to 10000ms to get rid of the problem app and debugger do not start.
Window -> Preferences --> DDMS under Android set 10000
b)Change the manifest, debug could be set as false. Instead to change it to true, to avoid the so called "hardcoding" just erase the line in the manifest and it will be recognized automatically as degug is true
c) Use step filters. otherwise you will receive a lot of source not found errors, because Eclipse Debugger is mainly set to catch Java code, activate step filters and add to all the libraries, also other two adding: android.* and com.android.*



 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should set breakpoints at those points in the code that you want to observe in detail; setting them on all methods is almost certainly not what you want. Breakpoints do not alter the flow of control - the code runs just as if there were no breakpoints.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic