- How To Install and Use Android Debug Bridge (adb) in Linux
- Install Android Debug Bridge (adb) in Linux
- Install Android SDK Platform Tools in Linux
- How to Use Android Debug Bridge (adb) in Linux
- Android Debug Bridge
- Installation
- Usage
- Connect device
- Figure out device IDs
- Adding udev rules
- Detect the device
- Transferring files
- Backup and restore
- Tools building on ADB
- Troubleshooting
- Empty device list
- No permissions error
- Arch linux install adb
- 1. Android SDK
- 2. Android
- How to Install ADB And Fastboot on Arch Manjaro Linux Easily
- Steps To Install ADB And Fastboot on Arch or Manjaro
How To Install and Use Android Debug Bridge (adb) in Linux
Android Debug Bridge (adb) is the most used command-line tool that enables the communication between a personal computer and a connected Android-powered device or emulator instance over a USB cable or TCP/IP (wirelessly).
It supports various device actions such as networking, scripting, installing and debugging apps, and file transfer. It also provides access to a Unix shell that can be used to run a variety of Linux commands on a device.
adb is a client-server tool that includes three main components:
- a client that runs on your development machine and sends commands. You can execute it from a command line by running an adb command.
- a daemon (adbd) that runs as a background process on each device and executes commands on a device.
- a server that manages communication between the client and the daemon, it runs as a background process on your development machine.
The adb command-line tool ships with the standalone Android SDK Platform Tools package, a component of the Android SDK. Let’s look at how to grab and install the latest version of the Android SDK Platform Tools package in Linux.
Install Android Debug Bridge (adb) in Linux
To install the adb package, run the appropriate command for your Linux distributions, as follows:
$ sudo apt install adb [On Debian, Ubuntu and Mint] $ sudo yum install adb [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a dev-util/android-tools [On Gentoo Linux] $ sudo apk add adb [On Alpine Linux] $ sudo pacman -S android-tools [On Arch Linux] $ sudo zypper install adb [On OpenSUSE]
Note: If you wish to use the latest version of adb, move to the next section to download and set up the latest binary from the Android SDK Platform Tools package release.
Install Android SDK Platform Tools in Linux
You can download the most recent version of the Android SDK Platform command-line tools from the SDK Platform Tools release page. Alternatively, run the following commands to download the archived package, extract it, and move it into the extracted folder:
$ mkdir cli-tools $ wget -c https://dl.google.com/android/repository/platform-tools-latest-linux.zip $ unzip platform-tools-latest-linux.zip $ cd platform-tools/
After extracting the archive file, you can list the content of the extracted folder and the adb command should be in there as shown in the following screenshot:
To check the version of the adb command-line tool you have just installed, run the following command:
$ ./adb version Android Debug Bridge version 1.0.41 Version 34.0.1-9680074 Installed as /home/tecmint/Downloads/platform-tools/adb
How to Use Android Debug Bridge (adb) in Linux
In the following examples, we will run the latest version of the adb command installed using the instructions in the previous section.
Once you have adb installed on your Linux system, connect your device to the computer via a USB cable and enable USB debugging in the device system settings, under Developer options.
Next, run the following commands to list the devices connect to the computer, make sure to check on the devices for any prompts to allow access.
From the output of the previous command, the string RZ8NA0V3HEY is created by adb to uniquely identify the device by its port number. The next column shows the device meaning the device is connected to the adb server. Other possible values are offline (device not connected or is not responding) and no device (means no device is connected).
To show more information about the device (device description for example product:a71naxx model:SM_A715F device:a71 transport_id:1), add the -l flag.
This is useful if many devices are attached to the computer:
To install an Android app using adb, use the install sub-command as follows. If you are installing a test app, remember to add the -t flag:
$ ./adb install ~/MusiX.apk OR $ ./adb install -t /path/to/testapp.apk
If you have multiple devices connected to the computer, use the -s option to specify the device’s serial number:
$ ./adb -s RZ8NA0V3HEY install ~/MusiX.apk
In case your connection to a device is lost, you can reset your adb host and start over from the beginning:
To view all available command-line options, issue the following command:
That’s it for now! For more information, check out the online adb documentation, which contains more use cases and command-line examples.
Android Debug Bridge
The Android Debug Bridge (ADB) is a command-line tool that can be used to install, uninstall and debug apps, transfer files and access the device’s shell.
Installation
ADB is part of the Platform-Tools SDK package and the android-tools package.
Usage
Connect device
- For some devices, you may have to enable MTP on the device, before ADB will work. Some other devices require enable PTP mode to work.
- Many devices’ udev rules are included in libmtp , so if you have this installed, the following steps may not be necessary.
- Make sure your USB cable is capable of both charge and data. Many USB cables bundled with mobile devices do not include the USB data pin.
To connect to a real device or phone via ADB under Arch, you must:
- You might want to install android-udev if you wish to connect the device to the proper /dev/ entries.
- plug in your android device via USB.
- Enable USB Debugging on your phone or device:
- Jelly Bean (4.2) and newer: Go to Settings > About Phone tap Build Number 7 times until you get a popup that you have become a developer. Build number may be under a menu called Software info on newer Android OS versions. Then go to Settings > Developer > USB debugging and enable it. The device will ask to allow the computer with its fingerprint to connect. Check allowing it permanently option will copy ~/.android/adbkey.pub to the target phone’s /data/misc/adb/adb_keys location.
- Older versions: This is usually done from Settings > Applications > Development > USB debugging. Reboot the phone after checking this option to make sure USB debugging is enabled.
If ADB recognizes your device ( adb devices shows it as «device» and not as «unauthorized» , or it is visible and accessible in IDE), you are done. Otherwise see the instructions below.
Figure out device IDs
Each Android device has a USB vendor/product ID. An example for HTC Evo is:
vendor id: 0bb4 product id: 0c8d
Plug in your device and execute:
. Bus 002 Device 006: ID 0bb4:0c8d High Tech Computer Corp. .
Adding udev rules
If your device is not included in android-udev (or android-udev-git AUR ), use the following template to create a custom udev rule by replacing [VENDOR ID] and [PRODUCT ID] with the IDs of your device.
/etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR=="[VENDOR ID]", MODE="0660", GROUP="adbusers", TAG+="uaccess" SUBSYSTEM=="usb", ATTR=="[VENDOR ID]", ATTR=="[PRODUCT ID]", SYMLINK+="android_adb" SUBSYSTEM=="usb", ATTR=="[VENDOR ID]", ATTR=="[PRODUCT ID]", SYMLINK+="android_fastboot"
Detect the device
After you have setup the udev rules, unplug your device and replug it.
List of devices attached HT07VHL00676 device
If adb still does not detect the device after plugging your device back in, kill and restart the adb server as root and check devices again:
# adb kill-server # adb start-server $ adb devices
If adb devices still shows unauthorized next to your device, make sure that that device has debugging permission allowed on the device itself. A Allow USB Debugging? dialog should be presented when you physically connect the device. Select Always Allow. , then tap OK. If the dialog was never presented, try Settings > Developer Options > Revoke USB Debugging Authorizations, then tap OK, and repeat the steps in this section. If you still do not see the Allow USB Debugging? dialog, and the device is listed as unauthorized, then enter the Developer Options on the device and first uncheck USB Debugging and then check it again.
Transferring files
You can now use adb to transfer files between the device and your computer. To transfer files to the device, use:
$ adb push what-to-copy where-to-place
To transfer files from the device, use:
$ adb pull what-to-pull where-to-place
Backup and restore
You can also backup and restore your device with adb. Moreover, no root is required to follow the process. The commands below led to backup your device to a single file which can also be successively restored.
The command to create a backup is:
$ adb backup -apk -shared -all -f backupFileName.ab
The command parameters list is:
adb backup [-f ] [-apk|-noapk] [-shared|-noshared] [-all] [-system|nosystem] []
Then confirm the process on your device’s display and provide a password whether a backup password has been set before.
The command to restore a previous backup is:
$ adb restore backupFileName.ab
Note: Remember that restoring operation will replaces your device contents with the backup contents.
Tools building on ADB
- adbfs-rootless-gitAUR – mount an Android device connected via USB.
- adb-sync-gitAUR – a tool to synchronize files between a PC and an Android device using the ADB protocol.
- androidscreencast-binAUR – view and control your Android device via ADB from a PC.
- logcat-colorAUR – a colorful and highly configurable alternative to the standard adb logcat command.
- scrcpy – display and control your Android device.
- qtscrcpyAUR – Android real-time display control software.
Troubleshooting
Empty device list
A possible cause for your device not showing up is not having enabled USB debugging on your device. See enable USB debugging.
No permissions error
If the device shows up with a «no permissions» label, it probably has a different vendor/product ID with respect to the ones collected by android-udev .
This can happen for instance when the device uses a custom ROM, or when it is switched from MTP to USB tethering mode, sideload and/or fastboot mode. Verify the actual device’s ID with lsusb and #Adding udev rules.
Arch linux install adb
If you using archlinux and want to develop android application. Then you must install Android SDK. To install manually you can download the package from android sdk website.
About Android SDK:
The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.
For the easy way to install, Android SDK & Platform Tools is available on AUR.
Note if you using Archlinux 64bit: You must enable multilib repo, to be able install the required packages.
1. Android SDK
$wget https://aur.archlinux.org/packages/an/android-sdk/android-sdk.tar.gz
$tar -xvzf android-sdk.tar.gz
$cd android-sdk
$makepkg -s
$sudo pacman -U *.pkg.tar.xz
2. Android
$wget https://aur.archlinux.org/packages/an/android-sdk-platform-tools/android-sdk-platform-tools.tar.gz
$tar -xvzf android-sdk-platform-tools.tar.gz
$cd android-sdk-platform-tools
$makepkg -s
$sudo pacman -U *.pkg.tar.xz
Done, all files installed on /opt/android-sdk/
To be able to use adb, fastboot, ddms, other commands you must create symbolic link to executable file manually. For this example:
and so on for other binary/executable files.
To run Android SDK, on LXDE is available on Programming Menu, then choose Android SDK. If android SDK not running. Same as above
Now try again to running Android SDK, if still not running try run on terminal
That’s some application on Android SDK & Platform Tools, now you can develop android Apps on Archlinx.
For Installing ADB only you can install android-tools
How to Install ADB And Fastboot on Arch Manjaro Linux Easily
ADB and Fastboot are part of the Android SDK. When you install Android Studio both of them are installed. But they are not always used altogether with Android Studio. They are both handy and powerful tool to perform many advanced tasks on Android OS using a desktop.
There was a time if you needed ADB or Fastboot only, you had to install the huge package of Android SDK itself. But a long time ago Google started making these tools available in standalone packages. Meaning you don’t need the whole SDK just to install and use these tools. So, I will be guiding you on how you can install ADB and Fastboot on your Arch or Manjaro system.
Installing ADB and Fastboot are essentially easy on Windows and even on Linux distribution. You just need is know the name of the package form which the tools will be installed. I have already provided a guide on how to install these tools on Debian based Linux distributions. It’s easy as that to install on Arch or Manjaro.
Steps To Install ADB And Fastboot on Arch or Manjaro
- Before installing ADB and fastboot make sure your system is up to date by running the following command as root on your terminal.
sudo pacman -S android-tools
If you get failed to start daemon error: cannot connect to daemon error, reboot your Linux system and try again.
Here’s a video guide for you,
Hoping that this post will help a lot of new Arch/Manjaro users. If you faced any issues try to watch the video guide or comment below. We would love to hear from you.