So, what happens if you mistakenly delete necessary files while developing on android? Well, I’ll tell you what happens – it will automatically load the recovery mode, and since some critical files are missing (like the sh and ls), you cannot even enter the device’s shell. If you, cleverly, try to do a “adb sync” command, and copy the necessary files, while in recovery mode, it will delete them after reboot.
To rescue the device, you need to flash the system.img, userdata.img and boot.img files – basically reflash the device. To do so, you need to reboot the device into bootloader (holding power-button & camera-button together - when the device is shut down, or using the “adb reboot bootloader“). When the bootloader screen comes up, connect the device to the PC, and if it the screen does not show “fastboot” instead of “serial 0” (or something like this), try pressing the back-button. If after all, the text “fastboot” doesn’t show up, then you will need to “upgrade” the bootloader. To do so, follow the instructions here: http://android-dls.com/wiki/index.php?title=Engineering_Bootloader. You might need to update the recovery partition as well, before you do the previous instructions: http://android-dls.com/wiki/index.php?title=Replace_Recovery_Partition.
When the bootloader is in “fastboot” state, you will need to enter the following commands, to reflash the device:
fastboot flash system system.img
fastboot flash userdata userdata.img
fastboot flash boot boot.img
That’s it! Just reboot the device, and it should load like new.
* You may get the “.img” files by compiling the android source code.
For more information refer to: http://androidcommunity.com/forums/f10/adb-fastboot-for-rookies-18124/.
Tags: android
