From Android zero to kinda-middle: a whole bunch of little useful things for your development workflow
By: Louis Tsai
Tags: Git, Android App Development, Debugging, Android

Android Profiler or Stetho or Flipper (or Chuck)

While it’s nice to be able to use the debugger, it’s not unusual for us to test “what the hell did I sent to the API”, usually to see if the JSON serialization is correct. For that, there are a lot of options to do that. Here’s the list of tools that I have found over the years:

Android Profiler requires basically no configuration, and currently it has the better UX IMO. Not only can you see the timeline of the network traffic, it’s also very easy to see all the parameters, payload, header, everything. It sound’s too perfect, right? Don’t worry, it has 1 potentially major potential flow: it somehow attach itself to the process that your app is in, and it may slow your phone down dramatically. While it makes zero configuration possible, it comes at a higher runtime cost. So depending on your situation, it might not be the best solution for you.

Stetho is a pretty ancient and popular library from facebook, which essentially allows you to intercept okhttp traffic and redirect it to the build-in dev tool of Chrome. It’s reliable, it doesn’t seem like it adds any performance or memory overhead (at least not enough to slow your apps down), and it’s kinda clever how they utilize the great network request timeline. However, since it’s just an interceptor, you are not catching all the network traffic of your app, like all the 3rd party library stuff. Another problem I have with it is that it does not provide good documentation on how to disable it for release build, and during my time of using it in one of my old company, I have see a fair share of apps have that still turned on because of some reconfiguration (probably). And probably because of all the complains and suggestions, facebook created and open-sources a new mobile debugging tool call Flipper, which looks like a decent replacement to Stetho. I haven’t use it a lot, because I am using Linux right now, and Flipper’s desktop client (instead of Chrome dev tool) is only officially available on macOS 😞

One “honorable” mention is Chuck, and it was my favourite network debugger back in 2017. The biggest selling point is that it persist the data locally on device, so you don’t have to plug it in to see what network call is happening. If you just stumble onto a bug, you can just scroll through the list and get it back, and that’s amazing! However, it looks like Chuck has become yet another dead project, and it has not been updated in a very very long time.

Show History (for Selection) & Annotate

Sometimes you look at a piece of code and be like

You can spend another 2 hours digging through the code, or, you can get help from your colleges, ideally the one who wrote that code. Only if there’s a good way to find that out……

Introducing: IntelliJ’s “Show History” feature! With “Show History”, you can see all the change history of a file. And if you selected a section of code, you can even “Show History for Selection” to narrow down the results! Now, with your new found knowledge, locate your college and solve your problem! Just remember, don’t be an asshole.

And just more minor tip: if you right click on the left hand side of code editor, you can use the “Annotate” feature to essentially highlight the last edit time and author of each line. It’s like a quicker version of “Show History for Selection” 👍