In this post I will talk about how to install ADB on linux and on Windows to control your Android device via USB without any problem.
But first of all I want to talk about other ways of controlling your phone through your computer but I think there are much more inefficient and takes more time to assume the commands or the orders that you type with your keyboard or mouse.
The other way that I tried and it works very well but not as efficient as adb is the VNC connection via wifi or internet. To do this I have installed in my phone the app DroidVNC server that you can find in Google Play Store.
It’s important to notice that your device must be rooted to use this app, so I recommend you to read my further thread about Custom ROMs and rooting devices. And it’s important to connect your device via WIFI not through the phone network to have more capacity of data transfer.
So I will assume you have your device rooted and you can give it superuser privileges.
To enable the connection you must open DroidVNC server and start it. It will show your the IP adress of your phone and the port you must connect to. Like in the following image:
To check that the IP adress of your mobile phone is the same that shows the DroidVNC Server app, you can use the next link: http://www.makeuseof.com/tag/find-ip-address-mobile-smartphone/ (Here shows the menu settings to check the IP adress which usually is in WIFI settings or configuration menu).
In my 2 devices to know where is the IP adress you must enter the menu:
Sony Ericsson Xperia neo V: Parameters –> Networks –> Wi-Fi parameters –> tab into the connected network!
Samsung Galaxy S GT-I9000: Settings –> Inalambric connections –> Wi-Fi settings –> tab into the connected network!
You can use this link to make the connection: http://opensourceexcedio.wordpress.com/2010/10/28/droid-vnc-server/
This method is very interesting because you can see the screen of your phone device at your computer’s screen but it will take some seconds for every thing you do, because it will move at the same time the phone screen and the visualization of the phone on the computer so it’s more efficient the adb shell although you won’t be able to see your phone’s screen. You will only see the terminal of your phone.
ADB (Android Debug Bridge) description: adb are two different applications — one running on your computer (Windows, Linux or Mac) and one running on your phone. When your phone is connected, and USB debugging is enabled, you can issue commands and communicate with the phone using your computer screen and keyboard.
So ADB is the quickest and most useful way to control your Android device through your PC by terminal prompt and make it more simple to enter commands that can be with your device.
Now we can begin with ADB way of communication. First you have to enable some settings of the phone before connecting it via USB to the computer:
Settings –> Aplications –> Unknown sources (enable this option)
Settings –> Aplications –> Development –> USB Debugging (enable this option)
Then you are prepared to catch the USB cable that comes with the device and connect it to your computer.
It will appear on your mobile a tab that shows that the device is connected through USB.
This is also explained in my other thread. So now we can proceed iwth the installation.
1) ADB install in Windows:
This link is the official page of Android operating system and this link talks about Android SDK (Software Developement Kit), which is a tool that provides you the API libraries and developer tools necessary to build, test, and debug apps for Android. It also brings the ADB tool, which is why we are interested in it: https://developer.android.com/sdk/index.html#download (here you have to download the file corresponding to your Windows system).
ADB (Android Debug Bridge) is a controller that will enable us to get superuser privileges and control our phone through our computer.
Here are the steps to get the ADB running in Windows: http://android.scenebeta.com/noticia/android-sdk (In Spanish).
To use the Windows cmd app, which is similar to the Terminal in Linux but the commands will not be the same. It can be useful to have some basic Windows 7 commands only to open and execute the ADB succesfully: http://norfipc.com/inf/comandos-consola-windows-7.html (In Spanish).
To begin with the install steps I have followed the next youtube video which tells you how to do it, and before the Android SDK you will have to install the java JDK to enable to run Android SDK. The video is in Spanish but for sure you can found the same video but in English doing a Youtube search: http://www.youtube.com/watch?v=ozVH0fBsdik
If you follow the steps of the video, for sure you will install the Android SDK without any problem. The Software will be placed in the following path in the Windows system: C:\Users\Usuari\AppData\Local\Android\android-sdk
Then you have to open your Android SDK software and download the drivers for your Android version in the options that appear, tick the correpsonding boxes and download them. It can last some 15 – 30 minutes depending on your connection. Be sure you have downloaded your android version drivers because if you download the incorrect ones, then it’s possible that ADB doesn’t work properly.
Then you will be able to control your phone via ADB and through the USB. To do this follow the next steps:
a) Open a cmd in Initial menu.
b) Enter the following commands:
Cd C:\Users\Usuari\AppData\Local\Android\android-sdk\platform-tools adb shell su chmod 777 /data/dalvik-cache cd /data/dalvik-cache chmod 777 ./
After this you are inside the phone and you can move freely wherever you want. It’s important to see that the command “su” is to enter with superuser privileges and it’s possible to don’t get access in case you don’t have you phone rooted or with a Custom ROM.
I will talk about how to root your device and flash it in a further thread.
2) ADB install in Linux:
The install process that I have used in Ubuntu and in Kali Linux is the same that is performed in the next link: http://blog.desdelinux.net/herramientas-para-gestion-de-dispositivos-android-desde-ubuntu/
In this case we don’t have to download the drivers because Ubuntu or any Linux distribution don’t need drivers to recognize the devices. So the install process is quicker. It works by terminal as in the case of Windows.
So there are the steps to get it running correctly:
sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install android-tools-adb android-tools-fastboot
Then the only thing we have to do is just enter the command:
(and this command will get access to our phone device via USB)
I repeat the same as before, you have to enable the USB debugging option in the settings menu as explained above and connect the phone through USB with the original cable.
To know which devices are connected in the moment you can enter, before the command of adb shell, the command:
This command will show how many devices are connected to the computer and their names.
Another tool that comes with adb shell and is not explained above in the Windows part are the commands named: adb push and adb pull.
These commands performs the task of copying files from the computer to the phone and viceversa, respectively. So if you enter a command like this:
adb push /home/usuari/Descargas/cm-10.2.0-galaxysmtd.zip /sdcard/
You are copying the file cm-10.2.0-galaxysmtd.zip (which is a Custom Cyanogenmod stable ROM) to the sdcard of your phone.
And if you enter something like this:
adb pull /sdcard/cm-10.2.0-galaxysmtd.zip /home/usuari/Descargas/
You are doing the contrary task.
These are very useful commands to move and copy files from your computer to your phone or viceversa. IN this case we are copying a ROM file but you can copy or move any kind of files, whenever the memory of your phone SDcard is enough to storage the files.
It can be possible that in some cases the adb push option, which comes with adb install doesn’t work properly. In such a case, follow the next steps to solve this problem:
adb devices → Accept the message on your phone! adb root → restarting as root! adb devices → Accept the message again! adb remount → remount completed succesfully! adb push /home/usuari/Descargas/cm-10.2.0-galaxysmtd.zip /sdcard/
And the problem is solved!
By this way we give privileges to the adb push to copy files into the android system. And with these privileges the adb push command is able to copy and move files on and out of the phones memory.
Here finishes my thread of adb install, I hope to be helping someone and enjoy it.