Mirroring Android UI for screencasts and demos
Here you can see me mirroring an Android device screen on a laptop:
From time to time, I need to demonstrate an Android application or concept and it’s much better to show it on a laptop or projector screen as opposed to just holding my small (well, not *that* small, it’s tablet-like) phone. There is an open source project that was created a while ago that makes this much easier, Android Screenshots and Screen Capture. Although the project doesn’t seem to have been updated for a while, it still works but requires a few tweaks to get running.
The basic installation process is:
- Install the Android Developer Tools (the ADT bundle is the way to go)
- Download the JAR version of the project
- Extract the project somewhere
- Open the JAR
At this point, the project will prompt you for the path to the SDK folder for Android. Use the file picker to select your SDK path. In theory, if your phone is in developer mode, it will mirror on the app. However, in my experience, it wasn’t quite that easy… The following debugging steps should help though.
Step 1: Is the ADB daemon running?
ADB, the Android Debug Bridge, is what lets you do all sorts of wonderful things with your Android device when it is connected to your computer (or to do this with Virtual Android Devices). There are a few things with ADB that pretty much any Android developer should know how to do, most importantly connecting, running / deploying apps on, and checking the status for connected devices. To turn on the ADB daemon and run it in the mode where it is listening to USB, run ADB with the usb command:
Note If the adb command is not in your PATH, it’s in your Android SDK folder under platform-tools.
When you run the adb usb command, you will get a response indicating that ADB is restarting and running in USB mode. Next, list your devices by running the list command through ADB:
Now, you should see your device listed and connected from ADB:
So, the problem isn’t the device…. what could it be?
Step 2: Fix ADB paths for ASHOTS
The Android Screenshots and Screen Capture app hasn’t been updated in a while as far as I can tell. The relevant change since its last release is that the Android tools have moved the path for the adb tool from the tools folder to the platform-tools folder. So, we’ll create a symbolic link from the old folder to the new folder to fix the path issue:
cd tools ln -s ../platform-tools/adb
Now when you run the JAR for the app, everything will work and for the next (n) hours you will be playing with Android apps projected on your laptop screen… and will be ready to demo mobile apps with ease.