Search

Ubuntu 12.04 - Install Android Tools (ADB, Fastboot & QtADB)

Contents[Hide]

dropcap-ubuntu-android

A new updated version Ubuntu 16.04 LTS - Install Android Tools (ADB, Fastboot & QtADB) is now available.
Please don't use this procedure anymore if you run latest Ubuntu Xenial 16.04 LTS

If you own an Android Smartphone, you will need sooner or later to use some specific Android tools like adb or fastboot.

If you need these tools, two options are now available under Ubuntu :

  • Install the whole Android SDK which bring these tools among may other things
  • Install some specific android-tools packages that bring only these tools

This article explains the simple steps needed to install Android tools, including latest Android SDK on Ubuntu Precise 12.04 LTS.

1. Setup ADB Udev Rule

Before accessing your android device in adb mode, you need to :

  • set the device to use USB Debug
  • declare a corresponding Udev rule on your Ubuntu box

After setting the device in USB Debug mode and connecting it to a USB port, throw the command :

# lsusb
...
Bus 002 Device 059: ID 18d1:4e42 Google Inc.

This is the result for a Google Nexus 7 connected in MTP mode with USB Debug on. It gives the Manufacturer and Model ID.

Now that we have these data, we can create the udev rules in /etc/udev/rules.d/99-android.rules.

# sudo gedit /etc/udev/rules.d/99-android.rules

/etc/udev/rules.d/99-android.rules

# Google Nexus 7 16 Gb
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666", OWNER="your-login"    # MTP mode with USB debug on

your-login should be your Ubuntu session login.

We can now restart udev for the new rules to become operationnal.

# sudo service udev restart

2. Install Android tools

If you don't plan to do some development on your android device, you don't need to install the complete SDK.

Two android-tools packages are now available for Ubuntu. They provide a minimal set of tools like adb and fastboot.

These tools are exactly what you need to root your phone, to flash a ROM, to side install an application, ...

2.1. Install Minimal Package

Thanks to Web8upd site these packages are kept up-to-date in a PPA for Ubuntu 12.04 LTS and later.

So, to install the tools, you just need to declare the PPA and install the packages :

# sudo add-apt-repository ppa:nilarimogard/webupd8
# sudo apt-get update
# sudo apt-get install android-tools-adb android-tools-fastboot

The tools are now available in command line.

2.2. Install Complete Android SDK

If you really need to install the complete android SDK, here are the steps.

I've only tested this installation process under Ubuntu 12.04.

2.2.1. Install Oracle Java 7

To install the complete Android SDK, first step is to install latest Oracle Java 7 runtime environment.

We also have to previously uninstall OpenJDK, as it is provided out of the box with Ubuntu Precise.

Oracle Java is not available in the official Ubuntu repositories anymore because that's not allowed by the new Java license.

We will get the help of WebUpd8 PPA to install it.

The package in the PPA automatically downloads (and installs) Oracle Java JDK 7 from its official website and installs it on the computer (it works like the flashplugin-installer).

# sudo apt-get purge openjdk*
# sudo add-apt-repository ppa:webupd8team/java & sudo apt-get update
# sudo apt-get install oracle-java7-installer

2.2.2. Install ia32-libs

Android SDK still needs the 32bits compatibility packages to run.

So, if you are running an AMD64 distribution, you need to install the well-known ia32-libs package.

# sudo apt-get install ia32-libs

This will download hundreds of packages and take ages ...

2.2.3. Install Android SDK

Download Android SDK.

Extract it to one folder & from that folder run these commands :

# cd ./tools
# ./android sdk

Get the default choice and start Install xx packages.

You are now running Android SDK on your Ubuntu box.

3. Allow ADB trusted connexion

Starting from Android 4.2.2 onward, a new security feature has been introduced within ADB.

You must confirm on your device that it is being attached to a trusted computer before any dialog can take place.

This security feature need adb version 1.0.30 and above.

You can check easily your ADB version :

# adb version
Android Debug Bridge version 1.0.31
# adb devices
List of devices attached
xxxxxxxxxxxxxxx          device

If your adb version is too old you'll get :

# adb devices
List of devices attached
xxxxxxxxxxxxxxx          offline

When you will plug your Android device for the first time, it will display a message asking you to allow connexion to your computer as a trusted computer.

You need to validate the message and to select the permanent checkbox.

4. Install QtADB

android-qtadb

QtADB is a powerful graphical Android device manager based on ADB protocol.

QtADB will allow you to :

  • have a complete access to your Android device filesystem
  • manage your installed applications
  • get some device informations (battery level, memory usage, ...)
  • take some device display screenshot

4.1. Prerequisite on Phone Side

To be able to fully use QtADB with your phone, it needs to :

  • be rooted
  • have busybox installed (without busybox installed, half of QtADB functionalities won't work)

If your phone is running CyanogenMod, you should also allow root access for ADB.

This is done thru Settings / Superuser / Settings

android-qtadb-cm-adb-root

You can test your phone configuration with the following command from your computer :

# adb shell busybox ls -l -a
drwxr-xr-x   16 root     root             0 Mar 30 14:27 .
drwxr-xr-x   16 root     root             0 Mar 30 14:27 ..
drwxr-xr-x    3 root     root             0 Mar 30 14:27 acct
drwxrwxrwt    2 root     root            40 Mar 30 14:27 app-cache
drwxrwx--x    1 system   cache         4096 Mar 31 14:08 cache
...

4.2. Installation

QtADB requires :

  • a working ADB installation (done previously)
  • Qt libs version 4.7

First step is to install the dependencies. You can then download executable from the site download section and install it.

Select the download package according to your distribution (32bits i386 or 64bits Amd64).

# sudo apt-get install libqtgui4 libqt4-network libqt4-declarative libqt4-opengl
# wget http://motyczko.pl/qtadb/QtADB_0.8.1_linux64.tar.gz
# tar -xvf QtADB*.tar.gz
# sudo mv ./QtADB*/QtADB /usr/local/sbin/qtadb
# sudo chmod +x /usr/local/sbin/qtadb
# rm -R QtADB*

QtADB is now installed on your computer.

4.3. Get Rid of the Startup Crash Bug

Version 0.8+ of QtADB is subject to a very nasty bug.

When you launch it, some internet update verification process makes it crash. 

# qtadb
Segmentation fault (core dumped)

As this update verification is set by default, we need to disable it.

This is done easily by creating the default QtADB.conf configuration file that disables the CheckForUpdateOnStart key :

# mkdir ~/.config/Bracia
# wget ~/.config/Bracia/QtADB.conf http://bernaerts.dyndns.org/download/ubuntu/qtadb/qtadb.conf

~/.config/Bracia/QtADB.conf

[General]
sdkPath=/usr/bin/
checkForUpdatesOnStart=false

QtADB should now stop to crash at startup.

4.4. Create Gnome Shell Launcher

Last step is to declare the application to the Gnome Shell launcher.

This is done by creating a qtadb.desktop file :

# sudo wget -O /usr/share/icons/android-qtadb.png http://bernaerts.dyndns.org/download/ubuntu/qtadb/android-qtadb.png
# sudo wget -O /usr/share/applications/qtadb.desktop http://bernaerts.dyndns.org/download/ubuntu/qtadb/qtadb.desktop

/usr/share/applications/qtadb.desktop

[Desktop Entry]
Encoding=UTF-8
Name=QtADB
Exec=/usr/local/sbin/qtadb
Icon=/usr/share/icons/android-qtadb.png
Type=Application
Categories=Utility;

You can now launch QtADB via your Gnome Shell desktop and your Android phone filesystem is now fuly accessible.

For example, your can take full screenshot of your phone display in one click.

ubuntu-android-qtadb-screenshot

Be careful, you have the full powers !

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus