Using ADB and fastboot | LineageOS Wiki (2024)

What is adb?

The Android Debug Bridge (adb) is a development tool that facilitates communication between an Androiddevice and a personal computer. This communication is most often done over a USB cable, but Wi-Ficonnections are also supported.

adb is like a “Swiss-army knife” of Android development. It provides numerous functions that aredescribed in detail by the command adb --help. Some of the more commonly usedcommands are listed in the “popular adb commands” section below.

Installing adb and fastboot

Google hosts zips including only adb and fastboot. You can set these up for use with the instructions below.

On Windows

  1. Download the Windows zip from Google.
  2. Extract it somewhere - for example, %USERPROFILE%\adb-fastboot
  3. On Windows 7/8:
    • From the desktop, right-click My Computer and select Properties
    • In the System Properties window, click on the Advanced tab
    • In the Advanced section, click the Environment Variables button
    • In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button
    • Append ;%USERPROFILE%\adb-fastboot\platform-tools to the end of the existing Path definition (the semi-colon separates each path entry)
  4. On Windows 10 or newer:
    • Open the Start menu, and type “advanced system settings”
    • Select “View advanced system settings”
    • Click on the Advanced tab
    • Open the “Environment Variables” window
    • Select the Path variable under “System Variables” and click the “Edit” button
    • Click the “New” button
    • Insert %USERPROFILE%\adb-fastboot\platform-tools in the text field
  5. Download the USB drivers and follow the instructions there.

On macOS

  1. Install Homebrew
  2. Add /opt/homebrew/bin to PATH by following “Next steps” listed at the end of installation output.
  3. Install android-platform-tools by running the following command: brew install --cask android-platform-tools.

On Linux

  1. Download the Linux zip from Google.
  2. Extract it somewhere - for example, ~/adb-fastboot.
  3. Add the following to ~/.profile:
    if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then export PATH="$HOME/adb-fastboot/platform-tools:$PATH"fi
  4. Log out and back in.
  5. You may also need to set up udev rules: see this repository for more info.

Setting up adb

To use adb with your device, you’ll need to enable developer options and USB debugging:

  1. Open Settings, and select “About”.
  2. Tap on “Build number” seven times.
  3. Go back, and select “Developer options”.
  4. Scroll down, and check the “Android debugging” or “USB debugging” entry under “Debugging”.
  5. Plug your device into your computer.
  6. On the computer, open up a terminal/command prompt and type adb devices.
  7. A dialog should show on your device, asking you to allow usb debugging. Check “always allow”, and choose “OK”.
    If the dialog is not appearing or the list of devices is empty, check if you installed adb properly.
    • On Windows: Make sure your device manager does show your phone and doesn’t show a yellow triangle next to it!

Congratulations! adb is now ready to use with your device.

Setting up fastboot

Using fastboot (if your device supports it) should simply involve rebooting to fastboot mode.While in fastboot mode, you can type fastboot devices to verify that your device is being detected.

Popular adb commands

  • adb shell - launches a shell on the device
  • adb push <local> <remote> - pushes the file <local> to <remote>
  • adb pull <remote> [<local>] - pulls the file <remote> to <local>. If <local> isn’t specified,it will pull to the current folder.
  • adb logcat - allows you to view the device log in real-time. You can use adb logcat -b radio to view radio logs,and adb logcat -C to view logs in colour
  • adb install <file> - installs the given .apk file to your device

Need help?

You can find assistance with LineageOS on our subreddit, or in #LineageOS on Libera.Chat.

Using ADB and fastboot | LineageOS Wiki (2024)

FAQs

Can you use ADB in fastboot? ›

Boot into fastboot mode

To enter fastboot mode when a device is undergoing a cold boot, use the key combinations listed in Fastboot key combinations. You can also use the command adb reboot bootloader to reboot directly into the bootloader. See Flashing instructions for full instructions.

What is the difference between fastboot and ADB? ›

Fastboot is also a middleman between your computer and Android devices. But in comparison to ADB, Fastboot only works when the device is turned off and is in the Fastboot/Bootloader mode. Using Fastboot, you can work with system partitions on your device, unbrick the phone, and flash custom ROMs and recoveries.

How to setup ADB and Fastboot on PC? ›

Installing adb and fastboot
  1. Open the Start menu, and type “advanced system settings”
  2. Select “View advanced system settings”
  3. Click on the Advanced tab.
  4. Open the “Environment Variables” window.
  5. Select the Path variable under “System Variables” and click the “Edit” button.
  6. Click the “New” button.

How do I enable USB debugging with fastboot? ›

If USB debugging cannot be enabled, enable fastboot flash mode. Turn your device off, then press and hold the power and volume down keys until the device starts in fastboot flash mode, then use a USB cable to connect your device with your computer.

How do I use ADB and fastboot? ›

To use ADB and Fastboot, you need to change the path in the app to point to the platform-tools folder you downloaded. There are a few ways to do this: The standard way is to use the cd command. Type cd [path to platform-tools] into the Command Prompt or Terminal window and hit Enter.

Can I unlock the bootloader in fastboot mode? ›

Once in the bootloader mode, to unlock the bootloader and enable partitions to be reflashed, run the fastboot flashing unlock command on the device. After setting, the unlock mode persists across reboots.

Is fastboot recommended? ›

While it can expedite the startup process, it may also lead to certain issues. For instance, it might interfere with the installation of updates that require a 'full' shutdown, or cause problems with systems that dual-boot with another operating system.

What is the advantage of fastboot? ›

Improved system performance: By reducing the amount of time it takes for your computer to start up, Fast Startup can also help improve the overall performance of your system. This is because the system files and drivers that are loaded during startup are optimized for speed and efficiency.

Is fastboot a bootloader? ›

Fastboot is a communication protocol used primarily with Android devices. It is implemented in a command-line interface tool of the same name and as a mode of the bootloader of Android devices.

How do I exit Fastboot mode with adb? ›

Begin launching the platform-tools folder. After this, run this press <“Shift+Right”> Open command prompt. Now use the Fastboot commands. Enter the “ADB Reboot Bootloader” and hit “Enter”.

How to use adb Fastboot to flash recovery? ›

Once you're in the Command Prompt, enter the following Command:
  1. adb devices. ...
  2. adb reboot bootloader. ...
  3. fastboot flash boot <kernel file name>.img. ...
  4. fastboot flash recovery <recovery file name>.img.

How to use adb without USB debugging? ›

Open the Wireless Debugging setting and tap the Pair device with pairing code option. You will see an IP address, port number, and a Wi-Fi pairing code. When using ADB on Mac, open the Terminal app, type cd followed by a space, and drag the Android SDK platform-tools folder to add its path.

Can you use fastboot without USB debugging? ›

USB Debugging responsible for ADB communication and not fastboot, both are different and if you want to mess with ADB then you need USB Debugging but for fastboot there's no need.

How do I force my phone to USB debugging? ›

On the device, go to Settings > About <device>. Tap the Build number seven times to make Settings > Developer options available. Then enable the USB Debugging option. Tip: You might also want to enable the Stay awake option, to prevent your Android device from sleeping while plugged into the USB port.

Does ADB work in recovery mode? ›

To my knowledge, only a few custom recovery ROMs allow file access via adb. Are you talking about user data files? In such a case you need a recovery ROM that in addition supports user data decryption because user data is stored always encrypted on Android devices released for many years.

How to use adb fastboot to flash recovery? ›

Once you're in the Command Prompt, enter the following Command:
  1. adb devices. ...
  2. adb reboot bootloader. ...
  3. fastboot flash boot <kernel file name>.img. ...
  4. fastboot flash recovery <recovery file name>.img.

How do I exit fastboot mode with ADB? ›

Begin launching the platform-tools folder. After this, run this press <“Shift+Right”> Open command prompt. Now use the Fastboot commands. Enter the “ADB Reboot Bootloader” and hit “Enter”.

How to add ADB and fastboot to path? ›

Setting up ADB Path on Windows: Android Tips.
  1. Step 1: Download Android SDK Platform Tools. ...
  2. Step 2: Extract the ZIP File. ...
  3. Step 3: Copy the ADB Folder Path. ...
  4. Step 4: Add ADB Path to Environment Variables. ...
  5. Step 5: Edit the “Path” Variable. ...
  6. Step 6: Add ADB Path. ...
  7. Step 7: Verify ADB Installation.
Sep 25, 2023

Top Articles
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 6621

Rating: 4.6 / 5 (56 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.