From now on, I will consider that you use AS, those who don’t will have to do by hand what is possible only via Android Studio (they can still look at the source code and copy/paste or ask around).
To debug an app, two tools are quite handy:
The log function, allowing you to print logs in the logcat (in the android tab, at the bottom of your screen)
You will need this :
As well as using the :
See this page for more information.
The debugger, working as many other debuggers around. For this, my main advice is: if you don’t understand how it works, ask someone who does. It wouldn’t be of any help If I tried to explain how it works here (it would probably not sound clear at all).