Heres a little cookbook of utilities that make working with Android devices easier.
TL:DR – Heres how to enable developer mode on your Android device, how to install ADB, how to use ADB to connect using a USB cable, how to use ADB to connect over your local WiFi network, how to use ADB to Sync content such as music or movies to your android device, how to pull videos our of your phone storage onto your computer, how to take a screenshot and save it on your local computer, how to record a movie of the screen of your android device, and how to open a Unix shell on your Android device from your computer.
How to enable developer mode on your Android device
Find the Build number on your Android device and tap it repeatedly. Childish but this is just how it has been since Android began.
- Google Pixel – Settings > About phone > Build number
- Samsung Galaxy S8 and later – Settings > About phone > Software information > Build number
- Tap the Build Number option until you see the message You are now a developer! Developer options are now enabled on your device.
- Return to the previous screen and a new menu appears called "Developer Options." Congratulations, you are now a developer. Keep it turned on.
- Enable USB debugging in the device system settings under Developer options. Look for Developer Options > USB debugging
Android Debug Bridge (ADB)
ADB is a command line tool that enables a variety of actions between a computer and an android device. Chiefly used by developers for example when testing new changes to apps it can install and reinstall apps, aid with debugging app issues, take screenshots, record the screen, and even open a Unix command shell on the connected device. It can do all this over your USB cable or even over your local WiFi. You can even control multiple devices at the same time for sophisticated real world testing or other activities.
adb is part of the Android SDK Platform Tools. If you are using Android Studio you can download this package with the SDK Manager, which installs it at
android_sdk/platform-tools/. If you want the standalone Android SDK Platform Tools package, download it here.
App developers will normally use ADB inside Android Studio which is a devlelopment environment for building Android apps. The direct download is useful if you want to use adb directly from the command-line and don't need Android Studio. (Android Studio will automatically update ADB but you likely dont care much about this). The Platform tools also include fastboot which helps if you want to unlock your device bootloader and flash it with a new system image. For file transfer we really only care about ADB.
How to Install ADB
The ADB tool can be downloaded with the Android platform tools provided by Google and is available for Windows, Mac and Linux. You’ll probably have these already if you use Android Studio, otherwise you can download them for your computer from Google, and if you do you'll earn a little badge for your Google Profile (see image), which is nice! You can put the downloaded folder anywhere really, although it is better if you add the folder to your path so the tools can easily be found from the command line, otherwise you have to use the full folder name to run the adb command.
How to use ADB to connect using a USB cable
- Connect the computer and device using a suitable USB cable.
- Say yes to the prompt on your device to authorise your device to connect to it.
- Open a command line and type adb devices and if you see your device listed you succeeded. If unauthorised unplug the cable and try again.
How to use ADB to connect over your local WiFi network
- Use a tool to find out the Android Device WiFi address see the WiFi Network details > IP Address in the WiFi Settings
- First complete the USB steps to authorise the device. You will need to do this using a cable to set up the authorisation before you can use the network to connect.
- Next start a network session for ADB adb tcpip 5555
- Now connect to the Android devices local WiFi network address adb connect xxx.xxx.xxx.xxx:5555
Sync media content to your Android device using Android SDK Platform Tools
if you need to sync content to a local Android device this method will change your world.
Android Debug Bridge (ADB) has been around since the first Android devices began to appear. It is a command line tool for working with a connected device. ADB is a developer tool for logging, opening a terminal, installing and uninstalling apps, backing up and restoring images and getting files from and putting files to the Android device. It has a sync command but that's not the right one. The command we are interested in is
adb push –sync, but how do you get it going?
Now connect your Android device to your computer ideally using a USB-C to USB-C cable.
Go to Settings > Device Options > Developer Options. Scroll down to USB debugging and enable it. You’ll be asked for approval to authorise the computer to connect. Approve it.
Now in the terminal type % adb devices and you should see your device is available to the computer.
% adb devices List of devices attached GCC2DM01234567890 device
If you’ve got this far you’ve cracked it. If not go back and check your USB settings or authorisation. Unplug the cable and try again.
Now navigate to your media folder at the command line in your terminal on your computer and you can sync it to your Fire Max 11
% cd ~/Music % adb push --sync . /sdcard/Music
This tells adb, to send all files newer than those existing from the current folder (which is denoted by a dot (.) to the Music folder on your Android device. It might take a very long time, leave it to run, and run it again if it fails. Once you have succeeded one time though, if you add a track on your computers library and run this command again it will only sync the newer files. This is exactly the behaviour I want. Now you have to make sure your music is DRM free and in a format that the Android device can deal with. Mine is mostly in .flac format which is fine.
'find and pull movies out of camera storage'
adb shell 'find /storage/emulated/0/DCIM/Camera/ -name "*.mp4" -print0' | xargs -0 -n 1 adb pull
Grab a screenshot to this folder
adb exec-out screencap -p > screen.png
Record the screen as a movie
adb shell screenrecord /sdcard/example.mp4