ADK debug tool, has improved a lot over few versions, each upgrade meant to be suitable as per developers. Now I can say it’s perfect for debugging android app.
Since android 7.0 google has provided a way to capture app logs through its pid (Process Id)! With it we can get in-app logs i.e log created using Log.i, Log.e in code (native). So using same approach as android studio does here is the implementation.
Note: On older phones there is new method of getting logs in ADK, so you still get those in-app logs.
Working Through
For testing purpose we are going to use this sample app which is written in Java. Compile the project and install it on your phone! The app looks like as shown in below image (containing two buttons)
By clicking on Show LOG button generates Log.i , Log.d, Log.w & Log.e messages and Create Exception button will throw an exception and will show its stack trace.
- In ADK, go to Debug > Custom Package (make sure app is installed). You will get a dialog as shown to choose your device!
- Select your device and you will be shown a new dialog will all available installed packages on your device. From here select package com.kpstv.exceptionsample. You can also use filter box to shorten your search list.
- Now click OK and wait till ADK automatically launches app and attach it the process. Once app is loaded click on both of button to see what happens!
You will see perfect log representation as shown. If you are familiar with android studio logging tool you will definitely find this useful. Also check the code of the sample app (given above) to check where logs are implemented!
Note: To stop logging click on Red stop button as shown above to stop capturing logs.
v1.0.6.8+