Android Tips
Rooting and Custom Rom | Getting Ready for ADB | Using ADB | ADB Over WiFi | Bootloops
ROOTING AND INSTALLING CUSTOM ROM.
before we begin you need to change some settings on the phone. go to SETTINGS -> APPLICATIONS check the box that says 'Unknown Sources'
then go to SETTINGS -> APPLICATIONS -> DEVELOPMENT and check 'USB Debugging'
Ok next you need a custom recovery image. there are two that i know of. Clockworkmod and Amon, for this tutorial i am using ClockworkMod.
go back to the Android Market and download ROM Manager by Clockworkmod. this will also install ClockworkMod Recovery Image. allow it to do its thing.now find what ROM you wish to run (ie: DangerRom, Cynogenmod, Fresh, Zen... etc...) download it to your computer and copy it to your SDCARD.next boot the phone in recovery mode. to do this turn the phone off. press and hold Home and Power until you get to the Clockworkmod recovery screen. using the trackball to scroll and select move down to Nandroid. and create a backup of your phone. (note: make sure that you have at least 30% battery before starting nandroid backup or restore.)once the backup is complete the Green text menu will appear at the top. use the back button on your phone to go back. now 'Wipe data/factory reset' and confirm.now choose 'Install zip from sdcard' then 'choose zip from sdcard' locate the ROM you want to install and select it. confirm your selections.wait for green menu to appear again select 'reboot system now' if this isn't an option use the back button and then choose it.this first boot will be a very very long one (can be up to 10 min). be very patient. if the phone goes into a 'bootloop' don't panic(this is described as the phone showing the HTC logo then the ROM logo then repeats over and over again. please note that it is normal for the HTC logo to come back once just before the getting started app loads) to fix a bootloop pull the battery from the phone to stop the process then boot in to recovery (home and power) and Wipe the data and the Dalvik cache. then reboot.if you are still stuck in a bootloop go back to recovery and choose nandroid -> restore and restore to your previous rom.
Getting Ready for ADB (Android Debug Bridge)
First a quick introduction to ADB (Android Debug Bridge). ADB is a command line tool that allows you copy files to and from your android device as well as re-boot the device into recovery/bootloader modes. ADB comes with the Android SDK (Software Developer Kit). To use ADB you must have the SDK installed on your computer. this is easy. you can download the SDK here (windows).
Once the SDK is installed you need to make sure that the TOOLS folder is in your system's PATH statement:
for Windows7: Open the Control Panel and Open System. The on the left pane click on Advanced System Settings. Now click on the Enviroment Variables button. from the list locate the path statement and click Edit. In both the User variables and the System variables add the following to the end of the path:
;c:\<path.to.android.sdk>\
(note that there is a semi-colon at the beginning.)
Ok, now that the SDK is installed, we need to open a command prompt with administrator privilages. The easiest way to accomplish this is to create a new shortcut on your desktop to the command prompt with these privilages.
To do this right click on your desktop and select New -> Shortcut When you are prompted to enter the location type CMD.EXE and click Next then click Finish.
Now right click on your shortcut and select Properties.
In the Start in: field type: c:\<path.to.android.sdk>\
Next click on the Advanced button and select the box marked Run as administrator.
Click on Ok. and Ok again.
Using ADB (Android Debug Bridge)
Using ADB is quite simple. however it may require that your phone be "rooted" for some/most features to work.
Open the command prompt that you made in the instructions above. This should open a Command window in the C:\<path.to.android.sdk> folder
make sure that your phone is connected via USB cable and that USB Debugging is turned on. (for help with this see the rooting guide above) when your phone connects make sure that it is setup for Charge Only and not diskdrive/usb mass storage mode.
Note that using this tool makes changes in real time to your phone but are not always immediately apparent and may require a reboot, it is very possible to get into a lot of trouble if you are not careful, overwriting the wrong file or copying a corrupt file can have severe consequences that may not be apparent until the next reboot. These errors and failures, while they may seem overwhelming when they happen can be completely corrected and undone in a short period of time on your own, see section below titled Bootloops.
now lets go over some basic ADB commands:
ADB DEVICES - this returns a list of the devices and or emulators that you have installed.
ADB REMOUNT - to mount the phone with read/write privilages use the command:
ADB REBOOT - reboots the phone normally
ADB REBOOT RECOVERY - reboots the phone in recovery mode
ADB REBOOT BOOTLOADER - reboots the phone to the bootloader
ADB REBOOT FASTBOOT - reboots the phone to in fastboot mode
ADB PULL - pulls a specific file from phone to computer (more on this command below)
ADB PUSH - pushes a specific file to phone from computer (more on this command below)
ADB INSTALL - installs a new app on your phone (more on this command below)
ADB UNINSTALL - uninstalls a specific app on your phone (more on this command below)
ADB CONNECT - connects to a specific ip address. see adb over wifi below.
There are more commands and loads of switches for ADB this is just a list of the most commonly used commands. for a complete list type ADB HELP from the command line.
ADB PUSH / PULL
These are very useful commands on a rooted phone with read/write access you can push/pull any file to or from the phone.
the usage is as follows:
ADB PUSH <local.path.of.file.on.computer> <remote.path.of.file.on.phone>
example: adb push c:/mydir/myfile.ext /sdcard/mydir
this will push myfile.ext from the c:\mydir folder on my computer to the mydir folder on the SDCARD on my phone.
ADB PULL <remote.path.of.file.on.phone> <local.path.of.file.on.computer>
example: adb pull /sdcard/mydir/myfile.ext c:/mydir/
this will pull myfile.ext from the /sdcard/mydir folder on my phone to the c:\mydir folder on computer.
note: if no local.path is specified the file will be pulled to the current working directory.
If you have problems using the push / pull commands or errors indicating that permission is denied, use the REMOUNT command then try again. If you are still experiencing problems make sure that your phone is rooted, if you are trying to write to the phones root folder or one of the system folders you will need to have root access.
ADB INSTALL / UNINSTALL
These commands allow you to quickly install and uninstall applications from your phone from the command line on your computer.
the usage is as follows:
ADB INSTALL <local.path.of.application>
example: adb install c:/myapps/myapplication.apk
this will install MyApplication to the phone.
ADB UNINSTALL <applicationname.apk>
example: adb uninstall myapplication.apk
this will uninstall MyApplication from the phone.
ADB (Android Debug Bridge) over WiFi
ADB over wifi allows you to do everything that you can do using adb normally, but without needing to have the usb cable connected.
First you need to have a rooted phone to use adb over wifi. Once you are rooted continue.
Open the Google Market on your phone and search for and install a free terminal program.
Make sure that your android is connected to your wifi and get the wifi ip address, this may be tricky but there are ways of finding it. One was is to compare the phones wifi mac address against the client list on your router, this should give you the ip address of your phone, i took it a step farther and setup my router to always give my phone the same ip address so that i don't have to search for it.
open the terminal program and type:
susetprop service.adb.tcp.port 5555
stop adbd
start adbd
Depending on your phones current configuration this may ask you to allow superuser permissions for the terminal program. if it does grant the permissions.
Open the command prompt shortcut that we created from the getting ready for adb how-to above and type the following command:
ADB CONNECT <wifi.ip.address>:5555
example: adb connect 192.168.0.105:5555
Note that these settings are not persistant. if your phones reboots you will need to do this entire process over again.
Now that i have taught you the long and technical way of doing this, there is an easier way. Search the Google Market for adbWireless, this application will setup the phone side of this for you, removing the need to type the commands into terminal program. This program will also tell you what the wifi ip address of your phone is as well.
Bootloops are defined as the phone beginning the boot process then hanging for an extended period of time and suddenly restarting the boot process. These are why performing nandroid backups before making any chages to the system files on your phone is essential. for more information about nandroid see the rooting guide above
To stop this behaviour you must pull the battery from the phone to power it off. Next you need to boot the phone into recovery mode by holding down the HOME button and the POWER button at the same time until you get to the recovery screen. (procedures for this may vary. You can check for your phones specific procedure on xda)
Assuming that you have made a nandroid backup you can now restore your phone from backup and reboot and you are fixed. note that you will lose any apps or customizations that you have installed since that backup.
If all else fails, you can fully restore your phone back to factory defaults by downloading your carrier and phones specific RUU file. these are usually available from your providers website. this will put your phone back to the way it was when you first bought it.
