Skip to main content

Posts

Showing posts from September, 2017

Android Tip : ADB couldn't find device interface error

Android Tip : Adb couldn't find device interface error I recently faced this error during my development and wanted to share with you all what I learned while debugging this. First of all, I’d take this blog post as an opporutnity to share with you briefly on how adb works. There are three major components : Adb Client : It’s a client that runs on your development machine and is used to send commands to your device Adb deamon : It’s a process that runs on your device/emulator. It’s responsible for receiving the commands that you issue via adb client and execute them in a new thread/process. Adb server : This process runs on your host machine and manages communication between your adb client and adb process on the device. The adb server runs on port 5037 (by default) and listens for commands that you issue via your adb client. As stated in the docs , the server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range

Android Loopers

This post comes out of a crash fix that I just did for my codebase. We had been facing some ui delays in our app for past some time now and it was beyond a comfortable user experience now. So we decided it was time to sit down and solve the issues behind this. As you’d have guessed, we were doing some things on main thread that we shouldn’t have been doing. The tool that helped us track down the exact things is BlockCanary . It’s a great tool that prints the whole stacktrace of the method call that’s holding your main thread. So, we quickly pushed all of this work to our background thread. In doing so, we didn’t realise that we were creating a handler in of those things for the current thread so that we could post some runnables on it. If you have worked with handler s before, you’d have guessed it by now. The app started crashing. And the reason was, handler requires a looper to be running on a thread and we didn’t create one. It was working correctly before because the code w