ADB basics for HTC EVO users
This guest article was written by MildlyDisturbed.
You've probably heard ADB mentioned a few times in the HTC EVO rooting world and may have steered clear because it's yet another tool you could use to shoot yourself in the foot. But it's actually a useful resource you should have (and know how to use) in case you run into problems later down the line and need to debug them.
ADB stands for Android Debug Bridge, and it's a part of the Android Software Developers Kit, which you will need to install first, in all of its huge glory, along with a Java Development Kit in order to use the one little ADB interface.
Basically, ADB is a program that provides many different options. One of these is a command-line interface (shell) for your EVO that allows you to perform file operations such as copy, move, delete, make/remove directories, create links, manage running processes, execute scripts (think batch file), and many other things.
ADB also allows you to see what is happening with your EVO in real time from the white HTC screen all the way through boot up by executing "adb logcat."
Ever wonder why your EVO takes so long to boot? Well, now you can watch each section and wonder why you have PayPal apks on your phone or see that it takes far too long on product X, and kill it. Or if you're wondering what is going on when you get an error "program has crashed," well now you might be able to see that it was trying to open package X.
Another great feature of ADB is the ability to push a file to the EVO from your computer. One time in a masterpiece of disasters, I made a Nandroid backup, realized I was low on space on the SD card, and then moved my backups off the card. I installed a new ROM, it didn't work, and I realized that the Nandroids and other ROMs were on my computer and I couldn't boot to a point where I could mount the phone as a drive. Enter ADB Push, which got another ROM on my SD card without requiring a working phone.
ADB is free and it can be a pain, but it's incredibly useful to have when something goes wrong. You can also use it to put new boot animations on your friends' unrooted phones. Install it today, 'cause when you really need it, waiting 30 minutes for it to download and install is frustrating.
Keep in mind after installing all that software, you'll need to turn on USB debugging on your EVO in order to use ADB. You can do that by tapping Settings > Applications > Development > USB debugging. Then you plug the phone into your computer and open up Command Prompt in Windows or Terminal in OS X. And should you ever tire of having to connect that pesky cable to your EVO, you can get ADB Wireless from the Market and do everything wirelessly.
A complete list of ADB commands is here but I'll go over a few of the more useful/used ones now.
ADB logcat – See what all is happening. You can run this while your EVO is at the white screen, and as soon as the logcat process starts up, you'll be able to watch the boot progress live.
ADB push <source destination here> – Let's say you have a file called C:MY ROMSPC36IMG.zip and you want to push it to the root of the SD Card so you can flash it later. The command to type would be adb push "c: my romsPC36IMG.zip" /sdcard/. ADB pull is used for the opposite (get a file off your EVO); it's generally not something you need to know, though, so I'll skip an example.
ADB install <filename here> – This attempts to install an apk. If you do a lot of rooting and want to set up a batch file to install a lot of your non-Market stuff (direct from vendor), this is a massive time-saver.
ADB shell – The most important command, in my opinion, of the bunch. This allows you command line access to your phone. (You can also do this on your EVO using an app like Terminal Emulator, but using ADB shell has the advantage of being able to use a real keyboard, and it can be done before the phone boots).
For those of you familiar with Linux shells, this is sort of like Android's lesser loved cousin version of it. There're not a lot of command-line commands included with our EVOs. There's a workaround for that I'll go into later, but some of the good shell commands are
- exit – If you don't know what you're doing, type this and hit enter. If you're done, type this a couple of times.
- su – This is superuser (if you're rooted) and you'll need it to do some things.
- top – See the list of running processes.
- mkdir – Make a directory.
- rmdir – Remove that directory you just made named "testing."
- cd – Change a directory.
- ls – Similar to the "dir" command in DOS.
- cp – Copy.
- mv – Move (similar to copy, except it only works on the same device and only leaves the file in the destination folder.
Depending on your ROM, there may be more or fewer commands available. Luckily, most ROMs include a program called busybox. You probably have heard of this in passing or when you installed Titanium Backup, but if you weren't sure what it actually was, it's an executable with a ton of functions built-in. Basically it's Swiss-Army-Linux. You can find a list of commands here.
Busybox has a ton of commands, but one of the most useful when attempting to find where your particular flavor of ROM has stashed stuff is "busybox find -iname <mask>," which will do a search on the SD card and internal memory for that file. So, assuming someone on another ROM says to change the bootanimation.zip but it's in a different location on your ROM , you can just run "busybox find -iname boot*" to find it.
There are tons of things you can do from the command line. You may never have to use ADB with your HTC EVO, but it's still a useful tool to know.
This guest article was written by MildlyDisturbed.