Thursday, May 23, 2024

Web Developer Diversion: Rooting Android Devices

Not all web developers are geeks, but most developers do enjoy a diversion from HTML5 and JavaScript from time to time. Android devices are a particularly interesting diversion, and many web developers have at least one such device around, “for testing mobile websites” if nothing else.

By rooting–that is, gaining root privileges–on an Android device, you are able to use many programs which require such access, and can do things like flashing a ROM on your device, or changing the boot animation and sound, which requires access to system files.

If you are new to the whole Android flashing scene, a few definitions are in order. A ROM (which stands for Read Only Memory) is where the operating system of the Android device is stored. A stock ROM is the one that comes with the device when you receive it. The custom ROMs you will be flashing are standalone versions of the Android operating system, which have been enhanced and changed. Some are newer versions of the Android OS, such as Gingerbreak or Honeycomb, while others are slimmed down, bloatware-free versions of the same version that is currently on the device.

In this article we will discuss the process of rooting your Android device–and in our next article we will move on to the process of flashing it with a custom ROM. I will also provide you with links to the tools and files you will need, as well as some supplementary websites and forums devoted to the topic.

So We Have a Flashing and Rooting Expert Here?

To clarify, I am not an expert by any stretch of the imagination, actually I am a relative noob, but I have rooted and flashed my two Android devices: a Dell Streak 7 tablet which I rooted and flashed to Honeycomb Android 3.2, and a Huawei Ascend phone which I rooted and flashed to Froyo 2.2. The process differs to a degree for each device, but the steps are very similar.

A Cautionary Note

Rooting and flashing an Android device is usually pretty straight forward, however there is always the chance that you will “brick” your device, that is, make it about as useful as a brick. If you are going to attempt to root or flash your device, be sure to make backups of your data, photos, music, videos, apps–pretty much everything, both internal and external storage. Sometimes the SD card is formatted, other times it is left intact.

You will have to re-enter all your contact information, or re-sync it with GMail, and you will have to reinstall all of your applications (that is, the apps that you installed, not those that come with the OS). You will also have to re-enter all of your wifi info, as well as your personal settings, etc. Essentially when it starts up after being flashed, it will appear just like it did when you first turned it on.

Also, some phone carriers have deemed it to void the warranty of their phones, so flash and root at your own risk!

One more thing: backup your device. Did I mention that you should backup your device before you root or flash your device? BACK IT UP!

Getting Started: Rooting Your Device

Okay, now that you’ve made backups of your device’s data and all the apps you’ve downloaded and installed on your device, you’re ready to root it. The first thing you’ll need is the rooting software itself. Which one you will need to use depends on the type of device you have, and the version of the Android operating system it is running. In this article, we’ll be discussing three such tools: Z4 Root, Gingerbreak and Clockwork Mod. For my Huawei Ascend phone I used Z4 Root when it was running Android 2.1, for instance, but when I rooted my wife’s phone, which she had upgraded using the stock upgrade process to Android 2.2, I had to use Gingerbreak to do the job (her phone is the same as my own). For my Dell Streak 7, which was running a stock Android 2.2 rom, I had to use Gingerbreak. Some phones or tablets won’t work with Z4 Root no matter which Android version they are running, so they must be rooted with Clockwork Mod.

The Z4 Root Tool

Z4 Root is a very slick tool that pretty much only takes one click to do its work. It is known to be compatible with the following devices–if they are running Android 2.1:

  • Backflip
  • Sony X10
  • Xperia Mini
  • Droid 2
  • Galaxy Tab
  • Galaxy I5700
  • Galaxy 3 I5800
  • Droid X
  • Droid 1
  • Samsung Acclaim
  • Cricket Huawei Ascend

If you would like to give it a try, you can download it here, or you can find it on the XDA Developers forum, which is an incredible source for all things Android. Once you’ve downloaded it, you can install it like you would install any other app. For instance, you can use FunTrigger’s AppInstaller or another, similar app. Also, you will have to set up your device to allow the installation of apps from Unknown Sources (you do this in Settings, Applications, Unknown Sources) and you will need to turn on Application Debugging (you also do this in Settings, Applications, Development, USB Debugging).

Once Z4 Root is installed, open it and select Permanent root. It will begin doing its thing, and will tell you that it is running exploits. Once it’s done, go into your apps and check if you have a new app called SuperUser. That’s the special little app that will allow other apps to access your device as root user. If you have the SuperUser app, your device is now rooted!

If you’d prefer to watch a video that shows you how to use Z4 Root, you can check out this one:

The Gingerbreak Rooting Tool

Gingerbreak, which was obviously designed to root devices running Gingerbread (Android 2.2), works in a way that is very similar to Z4 Root. It can be downloaded from the XDA Developers forum Gingerbreak thread. It’s installed the same way as Z4 Root, and it also requires the Unknown Sources and Debugging setup that is described above. You must also have an SD card inserted into your device (but Gingerbreak must be installed on the device, not the card). And, just like with Z4, once it’s installed, you just click it and sit back. The main difference is that it will reboot your device, and once it is rebooted, you will see the same SuperUser app that Z4 Root comes with.

Once you have run Gingerbreak successfully, you can remove it from your phone, as its work has been completed (the same can be said for Z4 Root–you only need to run it once, and once done, it can safely be removed).

Again, if you prefer to watch a video that shows how it is done, check this out:

Clockwork Mod

If Z4 and Gingerbreak just won’t do the job for your device, you may need to use Clockwork Mod. Currently, it is said that the following devices will need to go this route:

  • Desire
  • Desire HD
  • Magic
  • Evo
  • G2
  • Archos 70
  • myTouch 3G
  • Droid1
  • Wildfire
  • Droid Incredible
  • Samsung Galaxy S
  • Most HTC devices

Clockwork Mod can be downloaded here, and you can view a thread about the topic on the PPCGeeks forum.

With this method, you will need to connect your device to your PC via the USB cable, and you must extract the Clockwork Mod zip to a folder on your computer, open up a command console on your computer (you remember how to do that, right?), and run the file called run.bat. Then you just follow the on screen instructions and you’re all set–it installs the software on your device, gets root access and installs the SuperUser app.

For you video-centric folks, here’s a video showing how to do it:

Additional Android Apps

Although the following apps are not required to root your Android device, they are useful, and will come in handy should you wish to read and try out the next article on flashing your device to a custom ROM. The majority of them can be downloaded from the Android Market.

  • Rom Manager – Rom Manager takes care of backups and restores for your device, and also handles ROM flashing. It does require root access, so you will have to wait until you have rooted your device before you can use it. It also installs Clockwork Mod Recovery (CMR) through a graphical user interface, so if you haven’t installed CMR, you may as well do it the easy way (CMR also allows you to install a ROM from your SD card). Rom Manager is one of the most popular apps in the Android Market, which tells you how many folks are flashing ROMs.
  • Root Explorer – Root Explorer is similar to Windows Explorer, and allows you to view all the files on your device. It requires root access, and allows you to copy, paste and delete system files on your device.
  • BusyBox – Busybox is installed by several other apps, but if you don’t already have it, it provides many standard Unix tools that other apps may need. The maker refers to the app as “The Swiss Army Knife of Embedded Linux” (you did realize that Android is a variant of Linux, right?).

Additional Android Developer Resource Websites

If it wasn’t for the various Android developer websites out there, I would never have been able to actually root and flash my Android devices. The folks on these sites are amazing, and are continually working to improve their devices and software. If you have a question, go to the forums on these sites and read the FAQ before posting a question.

In our next article we will discuss the topic of flashing a custom ROM on your Android device, and where to get the custom ROMs. See you soon!

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Popular Articles