Home > Android > Setting up basic Android system for Nexus S

Setting up basic Android system for Nexus S

This howto tries to show what you have to install on your computer in order to start playing around with a Nexus S phone. It will guide you on installing the SDK, the adb tools, configuring an Ubuntu to connect to your Nexus S, etc. It is a very basic guide that you can also find in Android Developers.

Installing required system libraries

Install Java (Sun version).

$ sudo add-apt-repository ppa:sun-java-community-team/sun-java6 
$ sudo apt-get update 
$ sudo apt-get install sun-java6-jdk 

Install Android SDK

Download the Android SDK.

$ mkdir android 
$ cd android
$ wget http://dl.google.com/android/android-sdk_r12-linux_x86.tgz 
$ tar xvfz android-sdk_r12-linux_x86.tgz 

Next it is time to update the SDK tools. You need to be running X11 or using an SSH connection with X11 forwarding enabled as there will be displayed some dialogs to guide you through the installations.

$ mkdir android
$ cd android-sdk-linux_x86 
$ tools/android update sdk 

On the windows that are displayed select the Android libraries you considered. For the Nexus S using an Android 2.3.4 the selection is:

  • Android SDK Tools, revision 12
  • Android SDK Platform-tools, revision 6
  • Documentation for Android SDK, API 13, revision 1
  • SDK Plaftorom Android 2.3.3, API 10, revision 2
  • Samples for SDK API 10, revision 1
  • Google APIs by Google Inc., Android API 10, revision 2
  • Android Comptability package, revision 3
  • Google Admob Ads Sdk package, revision 3
  • Google Market Licensing package, revision 1
  • Google Market Billing package, revision 1

Once the process is done, you will have the SDK and platforms installed.

Use the phone from your computer

Attach your device to the USB and check device permissions.

$ cd android-sdk-linux_x86/platform-tools 
$ ./adb devices 

If you get the following, the everything is ok so you can skip the following and get skip the udev configuration step.

 List of devices attached
 0123456789ABCDEF device 

In case you get a message displaying no permisions then you have to deal with some stuff with udev.

 List of devices attached
 ???????????? no permissions 

Configure device permissions

Modify the udev rules to fit the Nexus S. There are several options for the rules file, choose just one.

$ sudo vi /etc/udev/rules.d/99-android.rules 
SUBSYSTEM=="usb", ATTRS{idVendor}=="####", SYMLINK+="android_adb", MODE="0666", GROUP="plugdev"


SUBSYSTEM=="usb", ATTRS{idVendor}=="####", MODE="0666", GROUP="plugdev" 


SUBSYSTEM=="usb", ATTRS{idVendor}=="####", MODE="0666" 


#Normal Nexus S SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e21", MODE="0666", OWNER="jlanza" 
#Debug & Recovery Nexus S 
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e22", MODE="0666", OWNER="jlanza" 
#Fastboot Nexus S 
SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4e20", MODE="0666", OWNER="jlanza"

To get the idVendor, run lsusb and get the value for your device (idVendor:idProduct)

$ lsusb 
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 001 Device 002: ID 18d1:4e22 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub 

Change rules file permissions and restart the udev environment.

$ sudo chmod a+r /etc/udev/rules.d/99-android.rules 
$ sudo service udev restart 

Detach and reattach your device from the usb.

$ ls -l /dev/bus/usb/001/010
crw-rw-rw- 1 root plugdev 189, 9 2011-08-19 15:24 /dev/bus/usb/001/010

Get the values from lsusb (Bus 001 Device 010). You should see something like this, indicating that the plugdev group is allowed to read and write from the device.

Restart the adb server

$ sudo killall adb
$ ./adb start-server
$ ps aux | grep
yourusername   27907  0.0  0.1  28148  1232 pts/3    Sl   15:24   0:00 adb fork-server server

This indicates the server is running as your user (better for security)
Check that the device is really attached.

$ ./adb devices
List of devices attached
  0123456789ABCDEF  device

You are done. The phone is recognized by the system and you can play around with it 😉

Accessing the phone through the USB cable

To get into the phone
$ ./adb shell

To grab files from phone

$ ./adb pull /system/etc/file.txt file.txt

To send file to phone

$ ./adb push this.txt /sdcard/this.txt

To install a package

$ ./adb install packagename

To go to recovery

$ ./adb reboot recovery

To go to Download Mode

$ ./adb reboot download

Also, do take note that when you pull a file, it will save itself in your android-sdk-linux_86 folder if no destination folder was given.
For more information [4].


[1] [GUIDE] Lazyman’s installation guide to ADB on Ubuntu 10.10 – Now with Ubuntu 11.04 ! – xda-developers
[2] “adb devices” yields “???????? no permissions” – Android Help
[3] Using Hardware Devices | Android Developers
[4] [GUIDE] ADB Workshop and Guide for everyone – xda-developers
[5] Howto: Install the Android SDK – CyanogenMod Wiki

Categories: Android Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: