• ADB for Android, basic adb Android commands. adb program - Installation and configuration instructions for working with Android

    If you have a smartphone with the Android operating system and you often experiment with it, configure something or reflash something, then most likely you are already familiar with the ADB tool or (Android Debug Bridge). This is a program for controlling a smartphone via a computer via USB, which contains many useful commands.

    You can view logs, install and uninstall apps, manage your device, and perform many other useful commands. In this article you will learn how to use ADB on Linux, we will look at useful commands adb for Android users and let's look at this utility in detail. But first, let's look at how to install the tool itself on your computer.

    ADB program is included as standard Android utilities SDK. You can install this environment and get the required utility. But you don’t always want to drag an entire execution environment onto your computer. Sometimes you only need one program. It can be very easily installed separately. On Ubuntu, you can do this by running the command:

    sudo apt install android-tools-adb

    For Red Hat, CentOS the command will be slightly different:

    sudo yum install android-tools-adb

    If you need to install ADB on Windows, you will have to download the Platform Tools SDK from the official website.

    Preparing your smartphone

    In order for you to be able to use adb with your smartphone, you need to enable USB debugging mode. This feature is hidden in all versions of Android starting from 4.2. To become a developer, first go to "Settings" -> "About the phone" and press seven times on the item "Build number":

    Then an item will appear in the main settings menu "For developers":

    Here you need to check the box next to the section "Allow USB Debugging":


    Now your phone is ready to work with adb. Connect it via USB to your computer and let's get started.

    Useful ADB commands

    Before we can control the device, there is one more thing we need to do. The adb command requires a special service to communicate with Android and needs to be started. To do this, use the following command:

    adb start-server

    After completion of work, you can disable the service so that it does not consume unnecessary resources:

    Now you can run adb commands for android.

    Device list

    First of all, let's look at the list of devices connected to our computer. To do this, use the devices command:

    If several smartphones are connected to the system, then by default the actions will be applied to the first one. But you can specify the desired device name using the -s option. For example:

    adb -s 0123456789ABCDEF logcat

    You can also specify the name of the device to which you want to apply adb program commands using the ANDROID_SERIAL variable:

    export ANDROID_SERIAL=0123456789ABCDEF

    Then that's it adb commands will be applied to the device specified in this variable.

    Device status

    With the get-state command you can find out the state of the device:

    The command will return one of the following values: device - running, bootloader - loading, offline - disabled. You can use the status-window command to constantly monitor status:

    adb status-window

    View logs

    The most common action that developers and testers have to do mobile applications in searching for errors - this is viewing system and application logs. To do this, use the logcat command:

    The utility displays the contents of Android logs in real time, so you will immediately see all error messages. You can also write everything to a file:

    adb logcat -d > ~/android.log

    Using the -c option, you can clear all logs on the device:

    It is not always necessary to look at the full system log; sometimes it will be enough to just see the messages the desired program.. To do this, simply specify the package name:

    adb logcat com android.settings

    Using the --log-level option, you can set the message detail level, the following options are available: V, D, I, W, E, F, S. To select the output detail, specify the desired letter separated by a colon after the application name:

    adb logcat com android.settings:E

    Or we will display only errors for the entire system:

    Transferring files to your device

    If you need to quickly send a file to a device, you can use the push command to do this. Here is its syntax:

    $ adb push /address/local/file/address/remote/file

    For example, let's download a file from the home folder to the device:

    adb push ~/file /sdcard/file

    The file will be instantly transferred to the device and you can verify it. Additionally, you can use the -p option to display progress, as well as the -a option to preserve the original timestamp.

    In the same way, you can download a file from your device. Pull command syntax:

    $ adb push /address/remote/file/address/local/file

    For example, let's copy the sent file back:

    adb pull /sdcard/file ~/file1

    Installing applications

    Using adb you can directly install applications. This feature can be very convenient for developers. The install command only needs to pass the address of the apk file:

    adb install ~/Momentum_apkpure.com.apk

    After this, the application is installed and ready to work on your device. If you need to update the application to a newer version, then use the -r option. This is very important. Otherwise you will get an error:

    adb -r install~/Momentum_apkpure.com.apk

    Options -s - for installation on a USB flash drive and -d - for downgrading the program version are also available.

    Uninstalling apps

    Uninstalling the app is also very easy. To do this, just pass the name of its package to the uninstall command. For example, let's remove the Firefox browser:

    adb uninstall org.mozilla.firefox

    Backup

    You can create backup copy its firmware and all system Android files so that it can be restored very easily and quickly later. To do this, use the backup command. Let's look at its syntax first:

    $ adb backup options packages

    The options indicate what data should be copied. Each option can have the prefix no, which means that this data does not need to be copied. Let's look at the main options:

    • -apk- save apk files for programs, disabled by default;
    • -obb- save extensions installed extensions apk files in obb format. Disabled by default;
    • -shared- save application data from SD card or phone memory, disabled;
    • -all- save all installed applications;
    • -system- save system applications, these applications are already included in the all list.

    The last parameter allows you to specify which applications should be saved. If the all option is specified, then naturally this parameter is not needed. So the command for backup the system will look like this:

    adb backup -apk -obb -shared -all -f backup.ab

    Using the -f option we specify the name of the archive file; it will be saved in the current folder. If you do not set it, the default name will be backup.ab. You will need to confirm the creation of a copy on your phone; you can enter a password for encryption:

    To restore from a backup, use the restore command. All she needs to do is pass the file address:

    adb restore android.ab

    The adb utility even has commands to reboot the device. You can simply reboot your smartphone using the reboot command:

    You can boot into recovery mode:

    adb reboot recovery

    Or to bootloader setup mode:

    adb reboot bootloader

    Android Console

    With the shell command you can login Android console and perform the necessary actions there. Most of the Linux commands we are familiar with are available here. We examined in detail all the available commands in the article. Now let's talk about the shell command itself and give some examples. To enter the console, type:

    adb shell ls /system

    For example, with this command you can take a screenshot:

    adb shell screencap -p /sdcard/screenshot.png

    And this is how you can record your smartphone screen on video:

    adb shell screenrecord /sdcard/video.mp4

    Conclusions

    In this article we looked at how to use the adb utility to manage Android smartphone, and also basic commands adb programs that you can use. adb shell commands are the same commands you can run in Android terminal, so there is no point in disassembling them again. I hope you found the information in this article helpful.

    About the author

    Founder and site administrator, passionate about open source software and operating systems Linux system. I currently use Ubuntu as my main OS. In addition to Linux, I am interested in everything related to information technology and modern science.

    Almost every owner Android device, which decided to improve its pet by replacing the firmware or operating system kernel, encounters a program adb.

    For most beginners, it is this program that becomes an insurmountable obstacle, and today we will tell you how to install and start working with this wonderful application, which will help you, for example, get root rights on your device, flash new versionAndroid or even restore your phone or tablet to original condition after unsuccessful intervention in the system.

    So what is it A.D.B. loved by all modders and hackers, where can we get it, and why do we need it?

    What is ADB.

    Abbreviation A.D.B. stands for Android Debug Bridge(Android debug bridge). ADB is integral part, which can be downloaded from here .

    Since the operating system Android is a variety Linux, to configure it, it is often necessary to work through command line. Of course, there are programs - terminal emulators that allow you to execute commands directly on the device, but, firstly, on small screen it is inconvenient to do this on a phone, and secondly, sometimes you need access to the device via a computer, and in these and many other cases the program adb simply irreplaceable. Program adb establishes a connection between the device and the computer and allows you to perform various manipulations with the system directly on the computer Android.

    How to install ADB.

    First of all, we recommend that you download the latest version, at the time of writing this guide the version available is r11, all further descriptions are based on her example, and more earlier versions, location necessary programs after installation SDK, may differ from what is described here.

    1. Download it, it can be found at the link provided earlier. There are several varieties SDK, For Microsoft Windows,MacOS And Linux.

    We need a variety for Microsoft Windows. And here there are two options - download the installer or zip archive with Android SDK. We don’t need an installer, especially since it won’t allow us to install SDK V Windows 7, and therefore download the zip archive.

    The archive contains a folder android-sdk-windows, which itself contains SDK. Unpack it onto your computer. In our example, we placed the folder at the root of drive C. If you do the same, the path to SDK we will have this: C:\android-sdk-windows

    In earlier versions SDK inside this folder in a folder tools the program we needed was located adb, but later it was moved by the developers to the folder platform-tools.

    However, if you go to this folder, you will not find the program inside it adb, so let's move on to next stage installations.

    2. Install SDK Platform Tools.
    We make sure that our computer is connected to the Internet and launch the folder located android-sdk-windows, program SDK Manager. After starting the program, the following window will appear:

    We need to download and install Android SDK Platform-tools And Android SDK Tools.

    By double clicking on an item or by clicking on “ Accept" And " Reject» Check these two items in the list and uncheck all other items, as shown in the above screenshot. Then click " Install"and wait until the components we need are downloaded and installed.

    Now we have adb installed on our computer, but to work with our phone or tablet we will need to install their driver and for further convenience with the program, it would be nice to write the path to it and other components in the Windows system.

    3. If we go to the folder C:\android-sdk-windows\platform-tools\, we can now find the program there adb.

    After this, we need to edit the PATH system variable so that every time we start the program and enter commands we do not have to type the path to the program, which looks like this:

    C:\android-sdk-windows\platform-tools\adb

    If you have never edited system variables, create a system restore point so that you can later return it to its original state.

    If you have installed Windows 7, right-click on the shortcut “ Computer", select " properties" and in the window that opens select " Additional options systems».

    If you have Windows XP, right-click on “ My computer" and then by " Properties»

    In the next window on the tab " Additionally» click on the button « Environment Variables " In the list " System Variables"select a variable" path" and press the button " Change…»

    The variable editing window will open, and in paragraph “h” variable value"at the very end of the line, after the semicolon, add the path to the folder tools and folder platform-tools:

    ;c:\android-sdk-windows\tools;c:\android-sdk-windows\platform-tools;

    (if there was no semicolon at the end of the line, add one - each path in this line must be separated from the other by a semicolon)

    If you installed in another folder, write at the end of the line your path to the tools and platform-tools.

    Installing device drivers.

    Some devices, such as company phones and tablets Samsung have their own software to synchronize with your computer, and if you have it installed on your computer, then the device driver is already installed on your system.

    But for devices like Nexus One, which are supplied without any additional programs and drivers for working with Android SDK, drivers need to be installed.

    To do this, go to the folder in which we installed SDK and launch SDK Manager.

    Exactly the same as we installed Android SDK Platform-tools And Android SDK Tools, find and select from the list “ Google USB Driver package" Click " Install"and wait while the program downloads the drivers. Drivers for 32 and 64 bit Windows will be downloaded to the following folder:

    C:\1\android-sdk-windows\extras\google\usb_driver

    You can now install drivers for your device. To do this, in the settings menu of your phone or tablet, select “ Applications"(Applications), and in it we include " USB Debugging "(USB debugging).

    We connect our device to the computer. The computer will detect new hardware and prompt you to install drivers. We install the drivers from the folder where they were downloaded earlier.

    After installing the drivers, a new device will appear in Device Manager " ADB Interface" and we can verify this by opening it by right-clicking on the icon " Computer» -> « Properties» -> « device Manager»

    Additionally, you can try installing a universal ADB driver on your computer.

    How to launch ADB

    Work with the program adb best way is through the command line Windows. To open the command line on a computer with Windows XP, click " Start" and in the input field " Execute» dialing cmd and press “Enter”.

    On a computer with Windows 7, click " Start" and in the input field "Find programs and files" we type cmd and press “Enter”.

    A command line window will open, and in order, for example, to see what devices we have connected to the computer, we type the command in it

    adb devices.

    Program adb will display a list of devices currently connected to the computer.

    If you want to know how to use Adb Run, then most likely you are already familiar with main program- Adb. If not, then consider these two tools for Android users. What are utilities needed for, how to configure and use them?

    Program

    So what is Adb? This is a program that gets its name from its acronym. ADB is an Android debug bridge. A tool for debugging, troubleshooting utilities, and unlocking gadgets on this operating system. These are the main features of the program, but if you are well versed in this topic, you will learn about a dozen more hidden options.

    Installation

    To understand how to use Adb Run, you need to install ADB on your PC. To do this, you need to download it from the official website of the developer. In principle, many sites make it possible to download this utility to your computer, so there will be no problems with the search.

    Connection

    To understand why ADB, and therefore Adb Run, is needed, let’s look at the basic commands. For example, if you are not sure that the computer sees the phone correctly and will work with it correctly, you can enter the adb devices command. This way you can make sure that the connection is stable.

    After you use the command, the program will display a message stating that List of devices attached. If you don’t see a similar phrase, then most likely the problem is either with the cable or with the drivers. You will have to double-check the functionality of the device and find out the reasons why the PC does not see the smartphone.

    If you find out that the cable is not working, you can try connecting the gadget via wireless network. Wi-Fi connection is made using ADB Wireless. In addition, the device must have Root permissions.

    Then enter the adb connect ip:port command. Instead of ip:port, enter the value that is set for your network address.

    Possibilities

    Since the question of how to use Adb Run is related to the use of ADB, it is worth understanding what capabilities the main utility hides. For example, thanks to the code, you can install an application that is located on your PC. To do this, you need to write adb install, and then specify the path where it is

    In the same way, you can transfer a regular document from a computer to a phone. The algorithm is the same, only the command has changed. We enter adb push, and then indicate the address of the location of the file that should be transferred to the gadget. If you need to do the opposite operation, enter adb pull. Only the first address indicates the folder on the phone, and the second - the location where you want to save transmitted document on PC.

    Adb Run

    This is a tool that makes your work easier. It is especially convenient for those who understand how to use the Adb Run program. The utility is designed to simplify working with ADB, provides functionality latest program clearer. The essence of the additional tool is that it automates the usual custom commands and greatly simplifies operations with the console. Adb Run can also reset the pattern.

    The program looks like a console. It consists of 14 items, and navigation through menus and sections occurs by selecting the desired number and the Enter confirmation button.

    Preparation

    Before learning how to use Adb Run this program, it is important to remember about USB debugging. This step is often forgotten, after which the program simply does not see the phone. To do this, you need to go to settings, find the “About phone” option there.

    IN latest versions operating system you need to find the line with the serial number and click on it several times. A notification appears at the bottom, first that you are on the right track, then that you have become a developer. When you see this message, you can go back to the settings, the “Developer Options” item should appear there. You can enable deferring there.

    Review

    A short overview of the utility and how to use Adb Run for Android. The first point right away is to check that the gadget is connected correctly. If you forgot about deferring, the program will immediately detect this. The first item is called Device attached. By selecting it, you will find out whether the phone is connected to the system.

    Next - point Move. Instead of entering the commands that were described earlier, it will be enough to choose between two items. The first one is responsible for transferring files from the computer to the phone, the second one is responsible for the reverse process.

    Third point Install is responsible for downloading applications to the gadget. There are five options available here. Among them are copying the program, installing it normally or on a memory card. It is possible to remove utilities from your phone via a PC or move them.

    Paragraph Reboot reboots the device. It does this in three options, among which there is a normal reboot, switching to bootloader mode or to Recovery menu. The next line under the fifth number is responsible for the firmware of the device. Fastboot is a menu that has 10 items. Moreover, they are all highly specialized; if you do not know what to choose, you will have to consider each sub-item.

    In the next paragraph - Unlock Gesture Key- you can learn how to use Adb Run with Windows 10 if you need to unlock the pattern. Often users, using this protection method, forget it, but when failures occur, this utility comes to the rescue. The sixth menu contains items with different options graphic key. You need to choose the one you forgot.

    Point seven - Manual- needed by those who want to enter commands themselves. There may be directives that are not in the list presented. This is what this menu item is for. There's a special menu for owners HTC smartphones. In it you can unlock Bootloader, change CID and get S-OFF.

    The eighth item checks for utility updates. The ninth is a creative option for those who are tired of the animation when turning on the device. If you want to replace it or disable it, then you need to go to the Intsall Bootanimation menu.

    The tenth paragraph provides information about all existing blocks of the device. There are sections here, perhaps hidden, or those that are difficult to reach. Run Script is the eleventh menu for using scripts. Backup is the twelfth point, which creates a backup copy of the entire gadget. Convenient if you need to do a Reboot.

    The next menu is responsible for odexing the firmware. If you are unfamiliar with this process, it is better not to experiment on your own. The fourteenth point is working on screenshots. The last menu is needed to exit the utility.

    Conclusions

    How to use Adb Run on Windows XP is clear. There is no difference at all with how this program works on Windows 7 or 10. Therefore, no problems should arise. The above instructions are suitable for all occasions.

    For Linux owners there is also an option that is easy to use. You just need to install a special version.

    Most Android users don't know anything about A.D.B.. Full name - Android Debug Bridge, stands for Android Debug Bridge. ADB is part of the Android SDK . At ADB help you can perform various actions on your Android tablet or a smartphone, such as: flashing, copying files from a computer to Android and vice versa, system recovery and others.

    ADB for Android - what is it?

    You probably know that the Android operating system is based on a modified Linux kernel. Therefore, there is a need to use the command line with it. It is the program adb helps establish communication between computer and Android. She is part of the environment Android development SDK, so to install Android Debug Bridge, you need to download Android SDK from the official website. There are versions for all popular ones operating systems: Windows, Mac OS and Linux. That is, to put it simply, adb allows control your phone or tablet using a computer.

    I also recommend the following instructions:

    Basic adb commands Android

    Connect your device to your PC via USB. Make sure all drivers are installed and USB debugging is enabled.

    Work with Android Debug Bridge best through command Windows string. To do this, in Windows XP, click “Start” and in the “Search programs and files” input field, enter “cmd”, then press “Enter”. If you have Windows 7 or higher, click "Start" and in the "Run" box type "cmd" and press "Enter" again.

    adb devices

    The most common adb command. Using it, you can determine whether your PC sees the connected device. If you did everything correctly, the following line will appear: “List of devices attached.” After it you will see serial number your smartphone or tablet and its status: “online” or “offline”.

    If it says “offline”, this means that the device is in sleep mode, if “online”, then the device is ready to execute your commands.

    Thanks to this command you can install applications on your smartphone or tablet. To do this, you need to specify the path where the APK file is located:

    adb intsall D:\papka_s_faylom\nazvanie_prilogeniya.apk

    To avoid writing long paths, copy the file to the android-tools directory. Then the path will be like this:

    adb intsall nazvanie_prilogeniya.apk

    adb uninstall

    You need to enter it in the same way as the previous command. This will remove the application.

    This team has an interesting feature. If you add the key -k, then when you delete a game or program, its data and cache will not be deleted, but will remain on the Android device.

    Thanks to this command, you can transfer files from your computer to Android. To do this, you need to know the full path where the file is stored and where to move it.

    adb push D:\papka_s_faylom\nazvanie_fayla/sdcard/Android

    To avoid writing long paths, copy the file to the android-tools directory. Then you need to enter:

    adb push nazvanie_fayla/sdcard/Android

    This command copies files from Android to computer. You need to know the path where the file is located on your smartphone or tablet and indicate the location where you want to save the file. If you do not specify the latter, the file will be saved in the android-tools directory.

    adb pull /sdcard/nazvanie_fayla\D:\papka_gde_sohranity

    This command will reboot your Android phone or tablet.

    With this command you can directly boot into bootloader mode.

    adb reboot recovery

    Not all devices support this command. Using it you can get into recovery mode.

    adb connect

    Using this command you can connect the device to Wi-Fi networks. To do this, you need to know the IP address and port of the device.

    adb connect ip:port

    With this command you get full access to all files on your device.

    Second way using adb shell is the execution of a single Android commands shell using this construct:

    adb shell<команда>

    If you put your Android phone or tablet into bootloader mode, then the commands adb will not work anymore. Here you need to use fastboot commands.

    To check if the PC and Android friend friend, use the command:

    After entering it, the serial number of your device should appear.

    By entering this command, you can unlock the bootloader of your phones and Asus tablets and HTC. When your device is in bootloader mode, enter:

    Also all yours installed programs and personal data will be lost.

    Using this command you can display the contents of a log file: changes, errors, etc. The data will scroll too quickly, so the right solution would be to save it in one TXT file. To do this, enter:

    adb logcat > filename.txt

    adb sideload

    The command will be useful for owners of Google Nexus devices. Using it you can update the firmware of the device. Download it to your computer, connect your Nexus to it, go to Recovery mode, select " Apply update from ADB" and then enter the command.

    Android Debug Bridge, or ADB for short, is a multifunctional utility for working with Android devices via the command line. ADB is Android component SDK. In this series of articles we will try to understand the basics of working with Android Debug Bridge.

    Android Debug Bridge is primarily designed to work with HTC devices, however, most features are available on others as well. mobile gadgets based on Android. Using ADB, you can debug Android devices, both physical and emulators. The program is based on the client-server principle. During the first launch, ADB using any command creates a so-called server in the form of a daemon (system service). This service will “listen” to all commands that are sent to port number 5037. Using ADB, you can perform actions such as: viewing connected devices and whether they can work with ADB; viewing system logs; copying files to and from an Android device; installing and uninstalling applications; deleting, clearing or rewriting (flashing) the data partition on an Android device; execution of scripts to control an Android mobile gadget; Manage some network parameters of an Android device.

    Does it work? Android service Debug Bridge can be done through the “Task Manager”, and there, accordingly, you can stop it if you wish. ADB comes bundled with a complete developer kit (SDK), including an emulator - which is why it weighs quite a lot. In order to get started, you need to unpack the archive from ADB, it is recommended to do this directly to the root of the disk C: adb. Important - there should be no Russian characters in the path to the folder. The folder where we unzipped ADB should contain the following files:

    adb. exe– directly ADB, with which we will work.

    AdbWinApi. dll– necessary for correct operation ADB library.

    AdbWinUsbApi. dll– another necessary ADB library, as the name suggests – for interacting with a device via USB.

    fastboot. exe– file for Android control-device transferred to fastboot mode. WITH .

    ADB is a console application, that is, it is operated and controlled via the command line. To open the command line in Windows, press the keyboard shortcut Win + R. You can also write cmd in the “Run” field (in Windows XP it can be called by clicking “Start” - “Run”, in Windows Vista/7 - “Task Manager” - “File” - “Run ...”). In order to go to the directory with ADB, enter on the command line:

    CDc: adb(or another path where we installed Android Debug Bridge)

    Let's figure out how to set up a connection to the device and drivers for correct interaction with our mobile device based on Android systems.. First, go to “Settings” - “Applications” - “Development” - check the “USB Debugging” box. The names of the items may differ depending on the mobile device model and firmware version, but the general meaning is the same in any case. After connecting the USB cable, select “Charge only”. After that, we recheck the connection between the Android device and the computer via ADB. Create in a folder adb file devices. cmd(please note that . cmd was a file extension, and not part of its name), we write the following into it.