Android: How to install adb and fastboot in Debian


We are going to install adb and fastboot tools in Debian (sid).

adb (Android Debug Bridge) tool allow us to communicate with an Android phone via USB (and TCP too)

fastboot allow us to flash some Android devices.


Install Android SDK (Stand-alone SDK tools)


adb and fastboot tools come within Android SDK.

Android developer page

Android SDK page


We download Stand-alone SDK tools (we don't need Android IDE)

$ wget dl.google.com/android/android-sdk_r24.4.1-linux.tgz

$ tar xvzf android-sdk_r24.4.1-linux.tgz


We also need to install Java (instructions from SDK page):

If you are running a 64-bit distribution on your development machine, you need to
install additional packages first.
For Ubuntu 13.10 (Saucy Salamander) and above, install these packages using apt-get:
libncurses5:i386, libstdc++6:i386, and zlib1g:i386

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

For earlier versions of Ubuntu, install the ia32-libs package using apt-get:

apt-get install ia32-libs

Next, install Java:

apt-get install sun-java6-jdk


$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

I install openjdk instead sun-java6-jdk
$ sudo aptitude install openjdk-8-jdk


Add SDK packages


SDK tools are not complete so we need to add some packages:

http://developer.android.com/sdk/installing/adding-packages.html

$ cd android-sdk-linux/
$ cd tools

We launch a graphic interface to add more packages:
$ ./android sdk

From the SDK page:

As a minimum when setting up the Android SDK, you should download the latest tools and Android platform:

Open the Tools directory and select:
Android SDK Tools
Android SDK Platform-tools
Android SDK Build-tools (highest version)
Open the first Android X.X folder (the latest version) and select:
SDK Platform
A system image for the emulator, such as
ARM EABI v7a System Image

Install them.



ADB


http://developer.android.com/tools/help/shell.html
http://developer.android.com/tools/help/adb.html

$ cd ..
$ cd android-sdk-linux/platform-tools

Export tools path:
$ export PATH=$PATH:$(pwd)
$ ./adb help
or
$ adb help

$ ./adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
0193e6ba51XXXXXX device


$ adb shell
shell@mako:/ $


FASTBOOT


https://wiki.cyanogenmod.org/w/Fastboot

$ adb reboot bootloader

$ fastboot devices
no permissions fastboot

I could run fastboot as root but better solve this problem using UDEV daemon.

$ lsusb
Bus 002 Device 005: ID 18d1:4ee0 Google Inc.

https://wiki.cyanogenmod.org/w/UDEV

I already pertain to group plugdev.

Edit and add to /etc/udev/rules.d/51-android.rules (for my mako device)
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="plugdev"


$ sudo udevadm control --reload-rules

$ sudo udevadm trigger

http://askubuntu.com/questions/82470/what-is-the-correct-way-to-restart-udev

$ fastboot devices
0193e6ba51XXXXXX fastboot