Android Setup for ADB and Fastboot: Difference between revisions

From Variscite Wiki
(Created page with "==What is adb?== The Android Debug Bridge (adb) is a development tool that facilitates communication between an Android device and a personal computer.<br> This communication ...")
 
No edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==What is adb?==
<!-- Set release according to "release" parameter in URL and use RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6 as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_N7.1.1_1.0.0_VAR-SOM-MX6}}}} <!--
--> {{PageHeader|{{#var:HARDWARE_NAME}} - {{#switch: {{#var:ANDROID_NAME}} | Android 10 = {{#var:ANDROID_NAME}} | Android 11 = {{#var:ANDROID_NAME}} | | Android 12 = {{#var:ANDROID_NAME}} | Android 13 = {{#var:ANDROID_NAME}} | Android {{#var:ANDROID_NAME}} }} - ADB and fastboot}} {{DocImage|category1=Android|category2={{#var:HARDWARE_NAME}}}} __toc__
 
= What is adb? =
The Android Debug Bridge (adb) is a development tool that facilitates communication between an Android device and a personal computer.<br>
The Android Debug Bridge (adb) is a development tool that facilitates communication between an Android device and a personal computer.<br>
This communication is most often done over a USB cable, but Wi-Fi connections are also supported.
This communication is most often done over a USB cable, but Wi-Fi connections are also supported.
Line 6: Line 11:
Some of the more commonly used commands are listed in the “popular adb commands” section below.
Some of the more commonly used commands are listed in the “popular adb commands” section below.


==Installing adb and fastboot==
= Installing adb and fastboot =
Google hosts zips including only adb and fastboot. You can set these up for use with the instructions below.
Google hosts zips including only adb and fastboot. <br> You can set these up for use with the instructions below.
 
== On Windows ==
Download the Windows zip from Google depending upon your OS.


===On Windows===
https://developer.android.com/studio/releases/platform-tools
Download the Windows zip from Google.
Extract it somewhere - for example, %USERPROFILE%\adb-fastboot


===On Windows 7/8===
=== On Windows 7/8 ===
# From the desktop, right-click My Computer and select Properties <br>
# From the desktop, right-click My Computer and select Properties <br>
# In the System Properties window, click on the Advanced tab <br>
# In the System Properties window, click on the Advanced tab <br>
# In the Advanced section, click the Environment Variables button <br>
# In the Advanced section, click the Environment Variables button <br>
# In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button <br>
# In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button <br>
Append ;%USERPROFILE%\adb-fastboot\platform-tools to the end of the existing Path definition (the semi-colon separates each path entry)
Append ''';%USERPROFILE%\adb-fastboot\platform-tools''' to the end of the existing Path definition (the semi-colon separates each path entry)
 


===On Windows 10===
=== On Windows 10 ===
# Open the Start menu, and type “advanced system settings”
# Open the Start menu and type “advanced system settings”
# Select “View advanced system settings”
# Select “View advanced system settings”
# Click on the Advanced tab
# Click on the Advanced tab
Line 28: Line 33:
# Select the Path variable under “System Variables” and click the “Edit” button
# Select the Path variable under “System Variables” and click the “Edit” button
# Click the “Edit Text” button
# Click the “Edit Text” button
Append ;%USERPROFILE%\adb-fastboot\platform-tools to the end of the existing Path definition (the semi-colon separates each path entry)
Append ''';%USERPROFILE%\adb-fastboot\platform-tools''' to the end of the existing Path definition (the semi-colon separates each path entry).<br>
Install the universal adb driver, and reboot.
Install the universal adb driver, and reboot.


== On macOS ==
* Download the macOS zip from Google
* Extract it somewhere - for example, ~/adb-fastboot
* Add the following to ~/.bash_profile:
if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi
* Log out and back in
== On Linux ==
* Download the Linux zip from Google
* Extract it somewhere - for example, ~/adb-fastboot.
* Add the following to ~/.profile:


===On macOS===
#Download the macOS zip from Google.
#Extract it somewhere - for example, ~/adb-fastboot.
#Add the following to ~/.bash_profile:
<pre>
  if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
  if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
  export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
  fi
  fi
</pre>
#Log out and back in.


* Log out and back in


===On Linux===
== Udev Rules for OTG / USB Device ==
#Download the Linux zip from Google.
You may also need to set up udev rules: see this repository for more info.<br>
#Extract it somewhere - for example, ~/adb-fastboot.
Refer to: https://github.com/snowdream/51-android<br>
#Add the following to ~/.profile:
<pre>
if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi
</pre>
#Log out and back in.


===Udev Rules for OTG / USB Device===
$ sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules
You may also need to set up udev rules: see this repository for more info.
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
$ sudo service udev restart


#Setting up adb
# Setting up adb
# To use adb with your device, you’ll need to enable developer options and USB debugging:
# To use adb with your device, you’ll need to enable developer options and USB debugging:
* Note: By default, it is enabled in our Android OS for Eng build.


Open Settings, and select “About”.
Open Settings, and select “About”.
Line 78: Line 87:
  adb push <local> <remote> - pushes the file <local> to <remote>
  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 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 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 color
  adb install <file> - installs the given .apk file to your device
  adb install <file> - installs the given .apk file to your device

Latest revision as of 19:24, 12 September 2023

VAR-SOM-MX6 - Android Nougat - ADB and fastboot

What is adb?

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

adb is like a “Swiss-army knife” of Android development. It provides numerous functions that are described in detail by the command adb --help.
Some of the more commonly used commands 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

Download the Windows zip from Google depending upon your OS.

https://developer.android.com/studio/releases/platform-tools

On Windows 7/8

  1. From the desktop, right-click My Computer and select Properties
  2. In the System Properties window, click on the Advanced tab
  3. In the Advanced section, click the Environment Variables button
  4. 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)

On Windows 10

  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 “Edit Text” button

Append ;%USERPROFILE%\adb-fastboot\platform-tools to the end of the existing Path definition (the semi-colon separates each path entry).
Install the universal adb driver, and reboot.

On macOS

  • Download the macOS zip from Google
  • Extract it somewhere - for example, ~/adb-fastboot
  • Add the following to ~/.bash_profile:
if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
	export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi
  • Log out and back in

On Linux

  • Download the Linux zip from Google
  • Extract it somewhere - for example, ~/adb-fastboot.
  • Add the following to ~/.profile:
if [ -d "$HOME/adb-fastboot/platform-tools" ] ; then
	export PATH="$HOME/adb-fastboot/platform-tools:$PATH"
fi
  • Log out and back in

Udev Rules for OTG / USB Device

You may also need to set up udev rules: see this repository for more info.
Refer to: https://github.com/snowdream/51-android

$ sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
  1. Setting up adb
  2. To use adb with your device, you’ll need to enable developer options and USB debugging:
  • Note: By default, it is enabled in our Android OS for Eng build.

Open Settings, and select “About”. Tap on “Build number” seven times. Go back, and select “Developer options”. Scroll down, and check the “Android debugging” entry under “Debugging”. Plug your device into your computer. On the computer, open up a terminal/command prompt and type adb devices. A dialog should show on your device, asking you to allow usb debugging. Check “always allow”, and choose “OK”. 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 color
adb install <file> - installs the given .apk file to your device