- Android Debug Bridge
- Contents
- Installation
- Usage
- Connect device
- Figure out device IDs
- Adding udev rules
- Detect the device
- Transferring files
- Backup and restore
- Tips and tricks
- Bash completion
- Tools building on ADB
- Troubleshooting
- Empty device list
- No permissions error
- linux-notes.org
- Установка android tools (ADB,fastboot, QTADB) на Debian/Ubuntu/Linux Mint
- 1. Настраиваем ADB UDEV правила
- 2. Установка android tools
- 3. Добавление ADB к разрешенным подключениям
- 4. Установка QTADB
- 6 thoughts on “ Установка android tools (ADB,fastboot, QTADB) на Debian/Ubuntu/Linux Mint ”
- How to Install ADB on Windows, macOS, and Linux
- What is Android Debug Bridge (ADB)?
- How does ADB Work?
- How to Setup ADB
- Phone Setup
- How to setup ADB on Microsoft Windows
- How to setup ADB on macOS
- How to setup ADB on Linux
- Examples of ADB Commands
- Bonus
- What else can I do with ADB?
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.
Contents
Installation
ADB is part of the Platform-Tools SDK package and the android-tools package.
Usage
Connect device
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. Allowing it permanently will copy
/.android/adbkey.pub onto the devices /data/misc/adb/adb_keys folder.
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:
Plug in your device and execute:
It should come up something like this:
Adding udev rules
Use the rules from android-udev (or android-udev-git AUR ), install them manually from Android developer, or use the following template for your udev rules, just replace [VENDOR ID] and [PRODUCT ID] with yours. Copy these rules into /etc/udev/rules.d/51-android.rules :
Then, to reload your new udev rules, execute:
Make sure you are member of adbusers user group to access adb devices.
Detect the device
After you have setup the udev rules, unplug your device and replug it.
you should see something like:
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:
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 «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
To transfer files from the device, use
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
The command parameters list is
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
Tips and tricks
Bash completion
In order to enable Bash completion, install one of the following:
- android-completionAUR – Bash completion for adb and fastboot , taken from AOSP.
- android-bash-completionAUR – Bash completion for android , adb , emulator , fastboot , and repo , developed independently.
Tools building on ADB
- adbfs-rootless-gitAUR – a FUSE filesystem over ADB.
- adb-sync (available as adb-sync-gitAUR ) – a tool to synchronize files between a PC and an Android device using the ADB protocol.
- AndroidScreencast (available as androidscreencast-binAUR ) – view and control your Android device from a PC (via ADB).
- logcat-colorAUR – a colorful and highly configurable alternative to the standard adb logcat command.
- scrcpy (available as scrcpyAUR ) – display and control your Android device.
- qtscrcpy (available as qtscrcpy-gitAUR ) – 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. You can do that by going to Settings > Applications > Development and enabling USB debugging. Since Android 4.2 (Jelly Bean), the development menu is hidden; to enable it go to Settings > About phone and tap Build number 7 times.
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 add the appropriate udev rules as described above.
Источник
linux-notes.org
Установка android tools (ADB,fastboot, QTADB) на Debian/Ubuntu/Linux Mint
Не знаете как установить fastboot на Ubuntu, Debian или Mint? Нужны android tools для программирования под андроид и не знаете как установить их? То данная статья «Установка android tools (ADB,fastboot, QTADB) на Debian/Ubuntu/Linux Mint» именно для Вас. Я все расскажу и покажу, на готовых примерах будет наглядно видно что и как нужно делать.
Если у вас есть Android смартфон, то вам нужно рано или поздно использовать некоторыми конкретными инструментами для Android, такими как ADB или fastboot. Эта статья объясняет, простые шаги, необходимые для установки Android инструментов, в том числе последней Android SDK на компьютере Ubuntu.
1. Настраиваем ADB UDEV правила
До того как Вы будите использовать ваше устройство android в adb mode, нужно:
…
Bus 002 Device 059: ID 18d1:4e42 Google Inc.
Этот вывод говорит что в системе имеется Google Nexus 7 и подключенный с использованием MTP mode и USB Debug on. Так же дает нам понят кто изготовитель и модель телефона (его ID).
Теперь, когда у нас есть эти данные, мы можем создать правила Udev:
your_login_from_OS — это логин с вашей ОС (Debian/Ubuntu/Mint).
Теперь перезапускаем наше созданное udev правило чтобы оно начало работать:
2. Установка android tools
Если вы не планируете делать разработку на андроид устройстве, вам не нужно устанавливать полный SDK. Два андроид-инструмента теперь доступны для Ubuntu и Debian в виде пакетов. Они обеспечивают минимальный набор инструментов, таких как adb и fastboot.
Эти инструменты нужны именно для того что бы получить полный доступ к вашему телефону (права root) , прошить ROM, или установить стороннее ПО.
2.1. Установка минимального пакета для работы
Добавляем репозиторий в систему для установки утилит:
Если «чистая ОС», то можно получить ошибку:
После чего все хорошо добавилось!
Обновим систему для того чтобы «подхватил» только что добавленный репозиторий:
Устанавливаем adb и fastboot:
Инструменты теперь доступны в командной строке.
2.2. Установка компилятора, android SDK
Если вам действительно нужно установить полный Android SDK, вот шаги.
Я проверил это только процесс установки под Ubuntu и Debian, все работало!
2.2.1.Установка ORACLE JAVA 7
Чтобы установить полный Android SDK, нужно для начала установить последнюю версию Oracle Java. Мы также должны предварительно удалить OpenJDK. Oracle Java не доступен в официальных репозиториях Ubuntu потому что это не разрешено в новой лицензии Java.
Пакет в PPA автоматически загружает (и устанавливает) Oracle Java JDK 7 с официального сайта и устанавливает его на компьютере:
Удаляем для начала openSDK, можно сделать следующим образом:
Добавляем нужный репозиторий и обновляем ОС:
Устанавливаем Oracle Java JDK 7:
2.2.2. Установка IA32-LIBS
Android SDK все еще нуждается в пакетах 32 бит совместимости для запуска. Так что, если вы работаете в распределение AMD64, необходимо установить пакет с a32-libs:
Эта библиотека скачает много пакетов, на некоторые нужно будет подтверждение.
2.2.3. Установка android SDK
Скачайте Android SDK. Извлеките его в одну папку и из этой папки запустите следующие команды:
3. Добавление ADB к разрешенным подключениям
Начиная с Android 4.2.2, была введена новая функция безопасности в ADB. Вы должны подтвердить на устройстве, что в настоящее время вы используете доверенное подключение к компьютеру.
Эта функция безопасности нужно ADB версии 1.0.30 и выше.
Вы можете проверить легко свою версию ADB:
Если ADB версия является слишком старой, вы получите:
Когда вы подключите ваш Android устройство в первый раз, он будет отображать сообщение и предлагает вам разрешить подключение к компьютеру в качестве доверенного компьютера. Вы должны прочитать это сообщение и выбрать установить флажок.
4. Установка QTADB
QtADB является мощным графическим менеджером для Android устройств на базе протокола ADB.
QtADB позволит вам:
- Иметь полный доступ к файловой системе Android устройства.
- Управлять установленными приложениями.
- Получить некоторую информацию устройств (уровень заряда батареи, использование памяти, …).
- Сделать некоторое скринши дисплея устройства.
4.1. Требования на стороне телефона
Чтобы иметь возможность в полной мере использовать QtADB с телефоном, он должен:
- Быть зарутован (be rooted)
- Должен быть установленный BusyBox на телефоне (без установленного BusyBox, половина QtADB функциональных не будет работать).
Если ваш телефон работает CyanogenMod, вы должны также получить полный доступ (root) для ADB.
Это делается через Настройки / суперпользователь / Настройки (Settings / Superuser / Settings)
Вы можете проверить вашу конфигурацию телефона с помощью следующей команды:
4.2. Установка QtADB.
Для QtADB требуется:
- Установленная и рабочая ADB (сделано ранее)
- Qt libs версии 4.7 или выше
Первый шаг заключается в установке зависимостей. Затем вы можете загрузить исполняемый файл с сайта в разделе загрузок и установить его. Выберите и скачайте пакет согласно вашей ОС (32-бит i386 или 64-бита AMD64).
Установим библиотеки, нужные для нормально работы:
Переходим в папку и скачиваем нужный для Вас архив:
После скачивания, распакуем данный архив:
Перенесем все в нужную директорию:
Выставим права на папку:
Удалим все ненужное:
Я установил и распаковал для х64- битной ОС и теперь QtADB установлено на ПК.
4.3. Избавляемся от некоторых ошибок
QtADB версии 0.8+ имеет неприятную ошибку.
Когда вы запускаете, некоторые интернет обновление при процессе проверки, дает сбои.
Segmentation fault (core dumped) Ошибка сегментации (ядро сбрасывается)
Когда это проверка обновление устанавливается по умолчанию, мы должны отключить ее. Это делается просто с помощью создания файла конфигурации по умолчанию QtADB.conf, который отключает клавишу CheckForUpdateOnStart:
Этот файл имеет следующие строки :
Теперь QtADB должно прекратить выделоватся и начать работать нормально при запуске.
4.4. Создать запуск GNOME SHELL
Последние шаги, объявите app при запуске Gnome Shell.
Это делается путем создания файла qtadb.desktop:
Объявляем все переменные:
Теперь вы можете запустить QtADB через ваш рабочий стол Gnome Shell и ваша файловая система Fuly в телефоне теперь доступны.
Создать запуск GNOME SHELL
Будьте осторожны, у вас есть все полномочия! МОЖЕТЕ ЧТО ТО НАТВОРИТЬ!
6 thoughts on “ Установка android tools (ADB,fastboot, QTADB) на Debian/Ubuntu/Linux Mint ”
У меня команды add-apt-repository на свежеустановленном последнем дебиане и в помине нету! Вообще статья неправильная, не вводите в заблуждение людей. По другому adb поставил и шаг с настройкой udev пропустил, ибо система сама всё за меня настроила)
Если «чистая ОС», то можно получить ошибку:
После чего все хорошо добавилось!
Кстати пакет называется android-tools-adb на debian. Потом никаких настроек udev делать не надо, debian избавил меня от лишнего геморроя!
Источник
How to Install ADB on Windows, macOS, and Linux
Several features of the Android platform can be accessed only through paths and methods that are hidden away from the average user. These have generally been done with the help of some command line Android Debug Bridge (ADB) commands, a tool that Google offers for developers to debug various parts of their applications or the system, but which we can use for all kinds of neat and hidden tricks. A prerequisite to these tricks is installing ADB on your computer. So, in this guide, we will show you how to install ADB on Windows, macOS, and Linux in quick and easy-to-follow steps.
Table of Contents:
What is Android Debug Bridge (ADB)?
The internal structure of the Android Debug Bridge (ADB) is based on the classic client-server architecture. There are three components that make up the entire process.
- The client, i.e. the PC or Mac you have connected to your Android device. We are sending commands to our device from this coomputer through the USB cable (and wirelessly as well in some cases).
- A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
- A server, which manages communication between the client and the daemon. The server runs as a background process on the PC/Mac.
How does ADB Work?
Because there are three pieces that makeup ADB (the Client, Daemon, and the Server), this requires certain pieces to be up and running in the first place. So if you have freshly booted the computer (and you don’t have it setup to start the daemon on boot), then you will need it to be running before any communication can be sent to the target Android device. You’ll see this the following message in the command prompt or terminal, as it will check to make sure the daemon is running.
If the daemon isn’t running, then it will start the process and tell you which local TCP port it has been started on. Once that ADB service has been started, it will continue to listen to that specific port for commands that have been sent by the ADB client. It will then set up connections to all running devices which are attached to the computer (including emulators). This is the moment where you’ll receive the authorization request on the Android device if the computer hasn’t been authorized in the past.
How to Setup ADB
Note: Setting up ADB on the computer is just half the equation since you’ll also need to do some things on the smartphone or tablet to accept the ADB commands.
Phone Setup
- Launch the Settings application on your phone.
- Tap the About Phone option generally near the bottom of the list.
- Then tap the Build Number option 7 times to enable Developer Mode. You will see a toast message when it is done.
- Now go back to the main Settings screen and you should see a new Developer Options menu you can access.
- Go in there and enable the USB Debugging mode option.
- You are partially done with the phone setup process. Next up, you will need to scroll below and follow the rest of the instructions for your particular operating system.
Follow along for the operating system on your computer.
How to setup ADB on Microsoft Windows
- Download the Android SDK Platform Tools ZIP file for Windows.
- Extract the contents of this ZIP file into an easily accessible folder (such as C:\platform-tools)
- Open Windows explorer and browse to where you extracted the contents of this ZIP file
- Then open up a Command Prompt from the same directory as this ADB binary. This can be done by holding Shift and Right-clicking within the folder then click the “Open command window here” option. (Some Windows 10 users may see “PowerShell” instead of “command window”.)
- Connect your smartphone or tablet to your computer with a USB cable. Change the USB mode to “file transfer (MTP)” mode. Some OEMs may or may not require this, but it’s best to just leave it in this mode for general compatibility.
- In the Command Prompt window, enter the following command to launch the ADB daemon:В adb devices
- On your phone’s screen, you should see a prompt to allow or deny USB Debugging access. Naturally, you will want to grant USB Debugging access when prompted (and tap the always allow check box if you never want to see that prompt again).
- Finally, re-enter the command from step #6. If everything was successful, you should now see your device’s serial number in the command prompt (or the PowerShell window).
Yay! You can now run any ADB command on your device! Now go forth and start modding your phone by following our extensive list of tutorials!
How to setup ADB on macOS
- Download the Android SDK Platform Tools ZIP file for macOS.
- Extract the ZIP to an easily-accessible location (like the Desktop for example).
- Open Terminal.
- To browse to the folder you extracted ADB into, enter the following command:В cd /path/to/extracted/folder/
- For example, on my Mac it was this: cd /Users/Doug/Desktop/platform-tools/
- Connect your device to your Mac with a compatible USB cable. Change the USB connection mode to “file transfer (MTP)” mode. This is not always required for every device, but it’s best to just leave it in this mode so you don’t run into any issues.
- Once the Terminal is in the same folder your ADB tools are in, you can execute theВ following command to launch the ADB daemon:В ./adb devices
- On your device, you’ll see an “Allow USB debugging” prompt. Allow the connection.
- Finally, re-enter the command from step #7. If everything was successful, you should now see your device’s serial number in macOS’s Terminal window.
Congratulations! You can now run any ADB command on your device!В Now go forth and start modding your phone by following our extensive list of tutorials!
While the guide above will certainly work, some seasoned macOS users should be aware that there can be an easier way to install ADB on their Macs using an unofficial package manager such as Homebrew or MacPorts.
How to setup ADB on Linux
- Download the Android SDK Platform Tools ZIP file for Linux.
- Extract the ZIP to an easily-accessible location (like the Desktop for example).
- Open a Terminal window.
- Enter the following command:В cd /path/to/extracted/folder/
- This will change the directory to where you extracted the ADB files.
- So for example: cd /Users/Doug/Desktop/platform-tools/
- Connect your device to your Linux machine with your USB cable. Change the connection mode to “file transfer (MTP)” mode. This is not always necessary for every device, but it’s recommended so you don’t run into any issues.
- Once the Terminal is in the same folder your ADB tools are in, you can execute theВ following command to launch the ADB daemon:В ./adb devices
- Back on your smartphone or tablet device, you’ll see a prompt asking you to allow USB debugging. Go ahead and grant it.
- Finally, re-enter the command from step #8. If everything was successful, you should now see your device’s serial number in the Terminal window output.
Congrats! You can now run any ADB command on your device!В Now go forth and start modding your phone by following our extensive list of tutorials!
Some Linux users should be aware that there can be an easier way to install ADB on their computer. The guide above will certainly work for you, but those own a Debian or Fedora/SUSE-based distro of Linux can skip steps 1 and 2 of the guide above and use one of the following commands:
- Debian-based Linux users can type the following command to install ADB:
- Fedora/SUSE-based Linux users can type the following command to install ADB:
However, it is always better to opt for the latest binary from the Android SDK Platform Tools release, since the distro-specific packages often contain outdated builds.
Just to cover all of our bases here, users may need to put a ./ in front of the ADB commands we list in future tutorials, especially when they are using the extracted binaries directly from the Platform Tools ZIP. This is something that is likely known by any *nix user (or Windows user running PowerShell) already, but again, we want as many people as possible to understand how to do these tweaks for Android no matter how much of your operating system you know.
Examples of ADB Commands
To check if you have successfully installed ADB, connect your device to your PC/Mac with your USB cable, and run the adb devices command as described above. It should display your device listed in the Command Prompt/PowerShell/Terminal window. If you get a different output, we recommend starting over with the steps.
As mentioned above, you can use ADB to do all sorts of things on an Android device. Some of these commands are built directly into the ADB binary and should work on all devices. You can also open up what is referred to as an ADB Shell and this will let you run commands directly on the device. The commands which are run directly on the device can vary from device to device (since OEMs can remove access to certain ones, and also modify adb behavior) and can vary from one version of Android to the next as well.
Below, you’ll find a list of example commands which you can do on your device:
- Print a list of connected devices: adb devices
- Kill the ADB server: adb kill-server
- Install an application: adb install
Copy a file/directory to the device: adb push
Bonus
For those who want to take this a step further, you can follow this new tutorial we put together that will walk you through how to set up ADB so that you can use the command from any directory on a Windows or Linux desktop.
What else can I do with ADB?
Below is a list of XDA tutorials for various devices that detail many applications of ADB commands in order to modify hidden settings, customize OEM features or user interfaces, and much more!
Источник