If you’ve ever tried to root your Android phone or flash a ROM, you may have heard about ADB and/or fastboot. These two tools are surprisingly powerful, but can be a bit overly complex to install. Here’s how to do it the easy way.
Via adb type command fastboot flash recovery recovery.img - or if you want use it only once without installation, type fastboot boot recovery.img How to recover Stock ASUS ROM: - Reboot into FASTBOOT MODE - via adb type command fastboot flash system system.img - via adb type command fastboot flash boot boot.img - via adb type command fastboot. Finally, boot Galaxy Note 9 Recovery Mode using: adb reboot recovery; The phone will instantly reboot and enter into the stock/TWRP recovery mode. So, now that you have succeeded to boot Galaxy Note 9 Download Mode and Recovery Mode. In several of our Note 9-specific tutorials, you will be asked to boot your phone your phone in either of the modes.
We love Android, but rooting your phone can give you the opportunity to do so much more than your…
Read more ReadAdvertisement
Update: Google recently released ADB and fastboot as a standalone download. Now you don’t need to download a huge developer kit just to mod you’re phone! We’ve updated our guide below to reflect the changes and to use Google’s official download instead of third-party services.
These two tools allow you to send terminal commands to your phone from your computer via USB. They both serve different functions, but they can be installed with relative ease at the same time, so it’s helpful to have both. Here’s a (very) brief breakdown on what these tools do:
Advertisement
Both of these tools come with the Android SDK, however that’s an extremely large download that, frankly, most users who are interested in ADB and fastboot don’t need. Fortunately, Google recently made it easy to get these two without all the junk.
Advertisement
Google collectively refers to ADB, fastboot, and a few other utilities as the Platform Tools package. You can download the Platform Tools package from the SDK website here. There are separate packages for Windows, Mac, and Linux so download the appropriate version for your platform.
Once you’ve downloaded the Platform Tools package, extract the contents of the .zip file to a folder you can find later (like “C:Androidplatform-tools”). You don’t actually need to install ADB and fastboot to use them, but you can take an extra step to make them more convenient for you.
Advertisement
By default, you’ll either have to navigate to the folder where you extracted the Platform Tools package and run any ADB or fastboot command from there, or write out the full path where ADB is every single time you want to run a command. For example, this is a simple command to see what devices are attached to your system:
adb devices
If your command prompt isn’t open to the location where you extracted the Platform Tools, however, you would have to type something like this:
c:Androidplatform-toolsadb.exe devices
That’s a pain to go through every single time you want to tweak something on your phone. To fix this, we can modify something called the PATH variable so that you can run ADB and fastboot commands no matter which folder you’re in.
Advertisement
Advertisement
The PATH variable is a master list of where to look for command line tools. By default your computer already knows where to find a few really useful tools. Here, we’ll add ADB and fastboot to that list to make it much easier to use them in the future. You’ll need to know where you extracted the Platform Tools package in the last step, so keep that folder location handy.
Depending on which version of Windows you’re using, these steps may be slightly different. To add ADB to your PATH variable, follow these steps:
;[FOLDERNAME]
to the end of the “Variable value” box, replacing [FOLDERNAME] with the folder path where you extracted Platform Tools. Be sure to include the semicolon at the beginning so Windows knows you’re adding a new folder.Advertisement
Now when you want to use ADB or fastboot, simply open a command prompt from the Start Menu and enter your commands.
Editing the macOS and Linux PATH files are a little more complicated than on Windows. However, if you’re comfortable with a command line, it’s still pretty simple. This method will automatically add the location of ADB and fastboot to your PATH every time you log into your system:
touch ~/.bash_profile; open ~/.bash_profile
source ~/.bash_profile
to run your Bash profile for the first time.Advertisement
From now on, any time you open a Terminal window, you can run ADB and fastboot commands from wherever you are.
we have android + linux m/c, we log in into linux shell and boot the machine in android GUI.now we have the some script that is running on the same machine through linux shell. In that case when the script hangs we need to restart android machine. but it result into restarting the linux machine too. as they are on same machine. so i need the way to restart the android so it comes out of hang state and control remains on the script that is running through the linux shell.
so is there any adb or linux command that work for me?
You can reboot the device by sending the following broadcast:
$ adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
Have you tried simply 'reboot' with adb?
Also you can run complete shell scripts (e.g. to reboot your emulator) via adb:
I summed up a few adb command on my page here that might help you.
adb reboot
should not reboot your linux box.
But in any case, you can redirect the command to a specific adb device using adb -s <device_id> command
, where
Device ID can be obtained from the command adb devices
command in this case is reboot
I think the only way to do this is to run another machine in parallel and use that machine to issue commands to your android box similar to how you would with a phone. If you have issues with the IP changing you can reserve an ip on your router and have the machine grab that one instead of asking the routers DHCP for one. This way you can ping the machine and figure out if it's done rebooting to continue the script.