How to Remove all Android -Tools (ADB and fastboot) plus SDK from Ubuntu 12.04 (64-bit)

Asked by ayacsa

So, I installed Android SDK to root my android phone, using script obtained thus:

wget http://linuxundich.de/static/android_sdk_installer.sh

chmod +x android_sdk_installer.sh

sudo ./android_sdk_installer.sh

(on my system: sudo /home/xxx/android_sdk_installer.sh)

Next, I also installed "android-tools" package (adb and fastboot) in 64-bit Ubuntu 12.04 from WebUd8 ( http://www.webupd8.org/2012/08/install-adb-and-fastboot-android-tools.html):

sudo add-apt-repository ppa:nilarimogard/webupd8

sudo apt-get install android-tools-adb android-tools-fastboot

Then I used:

sudo apt-get install android-tools-fsutil

to backport the Ubuntu Raring builds to Ubuntu 12.04

Just discovered the packages (android-tools, adb and sdk) take too much valuable space and would like to remove them, together with all associated packages.

Need comprehensive guide.

cheers.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu android-tools Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Yo (yleduc) said :
#1

Hi,
you can remove Ubuntu-SDK without re-installing Ubuntu. Once it is removed, you can also remove all library files associated with it.

    Run following commands in series:
     $ sudo apt-get autoremove android-sdk android-tools-adb android-tools-fastboot
    $ sudo apt-get --purge remove android-sdk
    $ sudo apt-get autoclean
    $ sudo apt-get autoremove

    Above commands will remove android-SDK from your system. If you get any error after any command, just edit your question and paste the result.

Revision history for this message
ayacsa (ayacsaev) said :
#2

So, I gave:

sudo apt-get autoremove android-sdk android-tools-adb android-tools-fastboot

Output was:

$: "Package android-sdk not found"

I do not know what's in the script android_sdk_installer.sh or what exactly it intsalled.

Cheers

Revision history for this message
ayacsa (ayacsaev) said :
#3

Correction:

E: Package android-sdk not found

Revision history for this message
ayacsa (ayacsaev) said :
#4

So, here is the text file of the shell script android_sdk_installer:

#!/bin/bash
#
# This script is designed to install the Android SDK, NDK, and Eclipse in
# Linux Mint 11 and make it easier for people that want to develop for
# Android using Linux.
# Script written by @ArchDukeDoug with special thanks to @BoneyNicole,
# @tabbwabb, and @animedbz16 for putting up with me and proofreading and/or
# testing the script.
# I can be reached at <email address hidden>, twitter, or linuxrandomly.blogspot.com
# Script version: 1.0.5
# Changelog: 1.0.5 - Fixed the Android SDK search parameters to fit the new
# naming scheme on http://developer.android.com/sdk

# Edit by christoph Langner http://linuxundich.de
# Removed installation von Android NDK and Eclipse

i=$(cat /proc/$PPID/cmdline)
if [[ $UID != 0 ]]; then
    echo "Please type sudo $0 $*to use this."
    exit 1
fi

apt-get update

#Download and install the Android SDK
if [ ! -d "/usr/local/android-sdk" ]; then
 for a in $( wget -qO- http://developer.android.com/sdk/index.html | egrep -o "http://dl.google.com[^\"']*linux.tgz" ); do
  wget $a && tar --wildcards --no-anchored -xvzf android-sdk_*-linux.tgz; mv android-sdk-linux /usr/local/android-sdk; chmod 777 -R /usr/local/android-sdk; rm android-sdk_*-linux.tgz;
 done
else
     echo "Android SDK already installed to /usr/local/android-sdk. Skipping."
fi

d=ia32-libs

#Determine if there is a 32 or 64-bit operating system installed and then install ia32-libs if necessary.

if [[ `getconf LONG_BIT` = "64" ]];

then
    echo "64-bit operating system detected. Checking to see if $d is installed."

    if [[ $(dpkg-query -f'${Status}' --show $d 2>/dev/null) = *\ installed ]]; then
     echo "$d already installed."
    else
        echo "Installing now..."
     apt-get --force-yes -y install $d
    fi
else
 echo "32-bit operating system detected. Skipping."
fi

#Check if the ADB environment is set up.

if grep -q /usr/local/android-sdk/platform-tools /etc/bash.bashrc;
then
    echo "ADB environment already set up"
else
    echo "export PATH=$PATH:/usr/local/android-sdk/platform-tools" >> /etc/bash.bashrc
fi

#Check if the ddms symlink is set up.

if [ -f /bin/ddms ]
then
    rm /bin/ddms; ln -s /usr/local/android-sdk/tools/ddms /bin/ddms
else
    ln -s /usr/local/android-sdk/tools/ddms /bin/ddms
fi

#Create etc/udev/rules.d/99-android.rules file

touch -f 99-android.rules
echo "#Acer" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"" >> 99-android.rules
echo "#ASUS" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0b05", MODE="0666"" >> 99-android.rules
echo "#Dell" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"" >> 99-android.rules
echo "#Foxconn" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"" >> 99-android.rules
echo "#Garmin-Asus" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"" >> 99-android.rules
echo "#Google" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"" >> 99-android.rules
echo "#HTC" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"" >> 99-android.rules
echo "#Huawei" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"" >> 99-android.rules
echo "#K-Touch" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="24e3", MODE="0666"" >> 99-android.rules
echo "#KT Tech" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="2116", MODE="0666"" >> 99-android.rules
echo "#Kyocera" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"" >> 99-android.rules
echo "#Lenevo" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="17EF", MODE="0666"" >> 99-android.rules
echo "#LG" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"" >> 99-android.rules
echo "#Motorola" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"" >> 99-android.rules
echo "#NEC" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0409", MODE="0666"" >> 99-android.rules
echo "#Nook" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="2080", MODE="0666"" >> 99-android.rules
echo "#Nvidia" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"" >> 99-android.rules
echo "#OTGV" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="2257", MODE="0666"" >> 99-android.rules
echo "#Pantech" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"" >> 99-android.rules
echo "#Philips" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0471", MODE="0666"" >> 99-android.rules
echo "#PMC-Sierra" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="04da", MODE="0666"" >> 99-android.rules
echo "#Qualcomm" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="05c6", MODE="0666"" >> 99-android.rules
echo "#SK Telesys" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="1f53", MODE="0666"" >> 99-android.rules
echo "#Samsung" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"" >> 99-android.rules
echo "#Sharp" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"" >> 99-android.rules
echo "#Sony Ericsson" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"" >> 99-android.rules
echo "#Toshiba" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="0930", MODE="0666"" >> 99-android.rules
echo "#ZTE" >> 99-android.rules
echo "SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"" >> 99-android.rules
mv -f 99-android.rules /etc/udev/rules.d/
chmod a+r /etc/udev/rules.d/99-android.rules

#Check if ADB is already installed
if [ ! -f "/usr/local/android-sdk/platform-tools/adb" ];
then
nohup /usr/local/android-sdk/tools/android update sdk > /dev/null 2>&1 &
zenity --info --text="Please accept the licensing agreement for Android SDK Platform-tools to install the Android Debug Bridge."
else
echo "Android Debug Bridge already detected."
fi
exit 0

Need help removing all packages associated with this script that are not needed by other packages.

Cheers.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

What is the output of:

lsb_release -a; uname -a; df -h

Thanks

Revision history for this message
ayacsa (ayacsaev) said :
#6

LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:cxx-3.0-amd64:cxx-3.0-noarch:cxx-3.1-amd64:cxx-3.1-noarch:cxx-3.2-amd64:cxx-3.2-noarch:cxx-4.0-amd64:cxx-4.0-noarch:desktop-3.1-amd64:desktop-3.1-noarch:desktop-3.2-amd64:desktop-3.2-noarch:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.0-amd64:graphics-3.0-noarch:graphics-3.1-amd64:graphics-3.1-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-3.2-amd64:printing-3.2-noarch:printing-4.0-amd64:printing-4.0-noarch:qt4-3.1-amd64:qt4-3.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Linux Guest-ThinkCentre-Edge71 3.2.0-72-generic #107-Ubuntu SMP Thu Nov 6 14:24:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/sda5 11G 11G 408M 97% /
udev 1.9G 4.0K 1.9G 1% /dev
tmpfs 381M 904K 380M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 74M 1.8G 4% /run/shm
/dev/sda7 184G 37G 138G 22% /home
/dev/sdb1 932G 105G 828G 12% /media/HITACHI

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

What is the output of:

dpkg -l | grep -i android

Thanks

Revision history for this message
ayacsa (ayacsaev) said :
#8

Output of dpkg -l | grep -i android:

ii android-tools-adb 4.2.2+git20130218-0ubuntu2+1~webupd8~precise Android Debug Bridge CLI tool
ii android-tools-fastboot 4.2.2+git20130218-0ubuntu2+1~webupd8~precise Fastboot protocol CLI tool
ii android-tools-fsutils 4.2.2+git20130218-0ubuntu2+1~webupd8~precise Android ext4_utils with sparse support
ii ibus-pinyin-db-android 1.4.0-1 Pinyin engine for IBus - Android database

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#9

What is the output of the command

du -sh /usr/local/android-sdk

Revision history for this message
ayacsa (ayacsaev) said :
#10

2.8G /usr/local/android-sdk

Thanks

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#11

Ok.

To remove the android packages: the commands

sudo dpkg --purge android-tools-adb android-tools-fastboot android-tools-fsutils ibus-pinyin-db-android
sudo apt-get --purge autoremove

should uninstall the packages (are of minor size).

The main space usage is in the /usr/local/android-sdk directory tree (2.8 GB)

If you are sure that there are no files that you need, you can delete everything with the command
sudo rm -rf /usr/local/android-sdk

Finally execute the commands

sudo updatedb
locate android-sdk

the check whether there are any additional files left (e.g maybe the tarball in your Download directory with 140 MB size)

Revision history for this message
ayacsa (ayacsaev) said :
#12

I first I tried:

sudo dpkg --purge android-tools-adb android-tools-fastboot android-tools-fsutils ibus-pinyin-db-android

(Lese Datenbank ... 232595 Dateien und Verzeichnisse sind derzeit installiert.)
Entfernen von android-tools-adb ...
Entfernen von android-tools-fastboot ...
Entfernen von android-tools-fsutils ...
dpkg: Abhängigkeitsprobleme verhindern Entfernen von ibus-pinyin-db-android:
 ibus-pinyin hängt ab von ibus-pinyin-db-open-phrase (= 1.4.0-1) | ibus-pinyin-db-android (= 1.4.0-1); aber:
  Paket ibus-pinyin-db-open-phrase ist nicht installiert.
  Paket ibus-pinyin-db-android soll entfernt werden.
dpkg: Fehler beim Bearbeiten von ibus-pinyin-db-android (--purge):
 Abhängigkeitsprobleme - wird nicht entfernt
Trigger für man-db werden verarbeitet ...
Fehler traten auf beim Bearbeiten von:
 ibus-pinyin-db-android

xxx@Guest-ThinkCentre-Edge71:~$ sudo apt-get --purge autoremove

Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Statusinformationen werden eingelesen... Fertig
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 2 nicht aktualisiert.

Then

xxx@Guest-ThinkCentre-Edge71:~$ sudo rm -rf /usr/local/android-sdk
xxx@Guest-ThinkCentre-Edge71:~$ sudo updatedb
xxx@Guest-ThinkCentre-Edge71:~$ locate android-sdk
xxx@Guest-ThinkCentre-Edge71:~$

Can't see any additional files in Download folder. Must i assume job is done?

Revision history for this message
ayacsa (ayacsaev) said :
#13

@m-hampl What of the unresolved dependencies?

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#14

Ok, on of the program packages was not removed (due to dependencies), but that should not matter.

What is now the output of
sudo apt-get update
sudo apt-get dist-upgrade
df -h
df -i

Revision history for this message
ayacsa (ayacsaev) said :
#15

Update returned no errors. The rest are as follows:

xxx@Guest-ThinkCentre-Edge71:~$ sudo apt-get dist-upgrade
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Statusinformationen werden eingelesen... Fertig
Paketaktualisierung (Upgrade) wird berechnet... Fertig
Die folgenden Pakete sind zurückgehalten worden:
  lxpanel pcmanfm
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 2 nicht aktualisiert.

xxx@Guest-ThinkCentre-Edge71:~$ df -h
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/sda5 11G 7.4G 3.2G 71% /
udev 1.9G 4.0K 1.9G 1% /dev
tmpfs 381M 908K 380M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 57M 1.9G 3% /run/shm
/dev/sda7 184G 31G 144G 18% /home
/dev/sdb1 932G 105G 828G 12% /media/HITACHI

xxx@Guest-ThinkCentre-Edge71:~$ df -i
Dateisystem Inodes IBenutzt IFrei IUse% Eingehängt auf
/dev/sda5 732960 281378 451582 39% /
udev 484834 550 484284 1% /dev
tmpfs 487038 511 486527 1% /run
none 487038 3 487035 1% /run/lock
none 487038 97 486941 1% /run/shm
/dev/sda7 12214272 49971 12164301 1% /home
/dev/sdb1 867318732 46664 867272068 1% /media/HITACHI

Revision history for this message
Manfred Hampl (m-hampl) said :
#16

As you can see there is 3.2 GB space free again on your root file system. I hope that is enough for you. IF not, you have to dig into the system to identify some more files that you can delete.

The only unexpected thing that I see, is that lxpanel and pcmanfm are not automatically updated.

What is the output of the terminal command

apt-cache policy lxpanel pcmanfm

Revision history for this message
ayacsa (ayacsaev) said :
#17

Gave
apt-cache policy lxpanel pcmanfm

output:

xxx@Guest-ThinkCentre-Edge71:~$ apt-cache policy lxpanel pcmanfm
lxpanel:
  Installiert: 0.5.8+git20120212-0ubuntu3
  Kandidat: 0.7.2.0.1+bzr1698+201412062101~ubuntu12.04.1
  Versionstabelle:
     0.7.2.0.1+bzr1698+201412062101~ubuntu12.04.1 0
        500 http://ppa.launchpad.net/lubuntu-dev/lubuntu-daily/ubuntu/ precise/main amd64 Packages
 *** 0.5.8+git20120212-0ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status
pcmanfm:
  Installiert: 0.9.10-0ubuntu2
  Kandidat: 1.2.3+bzr1405+201412070046~ubuntu12.04.1
  Versionstabelle:
     1.2.3+bzr1405+201412070046~ubuntu12.04.1 0
        500 http://ppa.launchpad.net/lubuntu-dev/lubuntu-daily/ubuntu/ precise/main amd64 Packages
 *** 0.9.10-0ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Manfred Hampl (m-hampl) said :
#18

I see that you have the official version installed, and there is an updated version available from a PPA.

If you want to update to the PPA version, you could try the command

sudo apt-get install lxpanel pcmanfm

I am not sure if that really works, there might be dependency problems with the PPA packages.

Revision history for this message
ayacsa (ayacsaev) said :
#19

Thanks Manfred Hampl, that solved my question.