I was running an Android 7.1.1 custom rom, more specifically PureNexus (which is a great rom by the way), in my Nexus 5X and decided to upgrade to the latest build of PureNexus. So I did what every good person would do, I created a nandroid backup utilizing TWRP and I thought I was redy to revert back in case something went wrong with the upgrade.
I downloaded the new build of PureNexus into my phone, along with the vendor image, super user and GAPPS, booted my phone into Recovery Mode and dirty flashed the brand new build, so far so good. When I rebooted the phone my System UI kept crashing, so I decided to re-flash the rom again. Went thru the same process, and yet again the System UI kept crashing, at this point I was frustrated and that’s when I realized the new PureNexus build was running Android 7.1.2 and I previously had Android 7.1.1, so now I was realizing I should have done a clean flash, as opposed to a dirty flash and since I did not want to mess with that, I decided to restore my precious nandroid backup, but lo and behold, the restore did not work for some reason.
So I was stuck with an useless phone and somewhere along this process I ended up bricking it. When I was trying to access my SD Card from TWRP, it showed an empty SD Card and empty system. My only options were to do a Factory Reset and Format Data from within TWRP.
After a complete phone wipe, I connected my phone to the computer, booted into Recovery (TWRP) Mode and transferred the rom image, super user and vendor image to the phone using ADB commands from my computer.
First head over to Android Developer to download the SDK Platform Tools, once you have the tools open cmd (Windows) or terminal (Mac/Linux) and cd into the platform tools directory and type
$ adb devices
This is to see if your computer recognizes your phone, if it does, you will see the serial number of your phone. Make sure you are booted into Recovery Mode.
If your serial number is not displayed, make sure Android Debugging is turned on. To turn it on go to Settings -> Developer Options -> Android Debugging.
Note: If you don’t see Developer Options, tap seven times in Build Number (Settings > About Phone > Build Number), you will get a toast message informing you that you have enabled Developer Options.
Now download your rom of preference, Vendor Image, Super User (to gain root access), and GAPPS and you will use adb push command to push the rom to the phone.
adb push takes two inputs, first one is the full path to the rom (in your computer) and the second one is the full path in your phone; I normally use /sdcard as the second input as it pushes to your phone’s SD Card.
$ adb push "/full/path/PureNexus.zip" /sdcard $ adb push "/full/path/rom/vendor.img" /sdcard $ adb push "/full/path/rom/SuperSU.zip" /sdcard $ adb push "/full/path/rom/GAPPS.zip" /sdcard
Now having the required files in your SD Card, you can flash the new rom/vendor image/etc in TWRP and get your precious phone back!