Prerequisites: Make sure you have a rooted Nexus-S device with write access to “/system”.
If you already have a rooted device, please refer to the instructions below:
Installing ADB and USB drivers is the first step in the Android development which allows you to connect your device to the PC. In this tutorial, we will show you how to setup ADB and USB drivers on Ubuntu.
If you already have a rooted device, please refer to the instructions below:
- Download the following program:Android-SDK
- Open the Gnome Teminal of your linux developer machine (Main Menu-Accessories-Terminal).
- In the Terminal, enter the following command: “sudo tar xvfz /home/<your-username>/Downloads/<android-sdk-file-name>.tgz”
Example:
username@machinename:~$ sudo tar xvfz /home/<your-username>/Downloads/android-sdk_r12-linux_x86.tgz
- Once the android sdk file is untared, enter into the terminal: ”sudo vi /etc/udev/rules.d/51-android.rules”
Example:
username@machinename:~$ sudo vi /etc/udev/rules.d/51-android.rules
- Add the following into the 51-android.rules file:
SYSTEM='usb' SYSFD{idVendor}'0bb4', MODE='0666'
SYSTEM='usb' SYSFD{idVendor}'18d1', MODE='0666'
- Then save and exit (:wq!)
- Afterwards, enter the following command into the terminal: “sudo chmod +x /etc/udev/rules.d/51-android.rules”
Example:
username@machinename:~$ sudo chmod +x /etc/udev/rules.d/51-android.rules
- Then edit the “.bashrc” file by entering into the terminal: “sudo vi .bashrc”
- Add the following on the top of the file:
#AndroidDev PATH
export PATH=${PATH}:/home/<your-user-name>/Downloads/Android-SDK/tools:/home/<your-user-name>/Downloads/Android-SDK/platform-tools
- Then save and exit (:wq!)
- Now, “cd” into the “tools” folder of the android-sdk directory, to make things easier.
Example:
username@machinename:~$ cd /home/<your-username>/Downloads/android-sdk/tools
- Once in the “tools” folder, enter into the terminal: “sudo chmod +x android”
Example:
username@machinename:~/Downloads/android-sdk/tools$ sudo chmod +x android
- Then update the software tools of your Android SDK program by the entering into the terminal the following command: “sudo ./android -v update sdk”
Example:
username@machinename:~/Downloads/android-sdk/tools$ sudo ./android -v update sdk
- Afterwards, “cd” into the “platform-tools” folder of the android-sdk directory.
Example:
username@machinename:~/Downloads/android-sdk/tools$ cd ~/Downloads/android-sdk/platform-tools
- Once in the “platform-tools” folder, enter into the terminal: “sudo chmod +x adb”
Example:
username@machinename:~/Downloads/android-sdk/platform-tools$
- Now go to your Nexus-S device and enable the “USB debugging” option (Settings-Applications-Development). This will allow the adb program to recognize your phone.
- Connect your Nexus-S device to the computer via USB cable.
- Then enter into the terminal: “./adb devices”. The serial number of your Nexus-S device should pop-up indicating that the phone is properly connected to the computer and that the adb program is recognizing your device correctly.
Example:
username@machinename:~/Downloads/android-sdk/platform-tools$ ./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
1234567ABCD123AB device
- Afterwards, enter into the terminal: “./adb shell” to invoke the adb shell.
Example:
username@machinename:~/Downloads/android-sdk/platform-tools$ ./adb shell
Note: for a list of adb functions, enter into the terminal: “./adb --help”
- Once in the adb shell, enter: “su”
Important:
Make sure your phone is ON and unlocked when requesting for Superuser permissions (su).
- A pop-up window will appear in your Nexus-S device. It is to confirm that you are granting adb to have “su” privileges on your device. Enable the “remember” option and then select “Allow”.
Note:
Your adb shell should look a bit different, it should now begin with a # sign instead of a $ sign. This is an indication that you are running as a Superuser in the shell.
- In the adb shell, enter the following command: “mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system”
Example:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
- Afterwards, enter: “exit” to stop running the shell as a Superuser.
- Enter into the shell: “exit” once again to leave the adb shell.
- Once you exit the adb shell, enter the following command into the terminal: “./adb install <name-of-file>.apk /system/app” or “./adb push <name-of-file>.apk /system/app”
Example:
username@machinename:~/Downloads/android-sdk/platform-tools$ ./adb install <desired-application-name>.apk
4975 KB/s (1109795 bytes in 0.217s)
pkg: /data/local/tmp/<desired-application-name>.apk
Success
- After .apk file installation is complete, re-invoke the adb shell by entering into the terminal: “./adb shell”
Example:
username@machinename:~/Downloads/android-sdk/platform-tools$ ./adb shell
- Once in the adb shell, enter: “chmod 6755 /system/app/<name-of-file>.apk”
- Then enter: “exit” to leave the adb shell.
- Afterwards, enter in to the terminal: “./adb reboot” to reboot your Nexus-S device and that’s it, you’re done!