Linux Scroll

Just another site

Category Archives: android

adb command for Android

In linux terminal,start adb daemons :

$ adb devices

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
S58305abcd123 device

Install apk:

$ adb install Desktop/talkbox_1_02.apk 

990 KB/s (1035830 bytes in 1.020s)
pkg: /data/local/tmp/talkbox_1_02.apk

Install update apk:

$ adb install -r Desktop/talkbox_1_02.apk 

990 KB/s (1035830 bytes in 1.020s)
pkg: /data/local/tmp/talkbox_1_02.apk

Uninstall apk:

$ adb uninstall

Copy files from phone to local drive:

$ adb pull /sdcard/Music Desktop/Music

pull: building file list...
pull: /sdcard/Music/1.mp3 -> Desktop/Music/1.mp3
pull: /sdcard/Music/2.mp3 -> Desktop/Music/2.mp3
2 files pulled. 0 files skipped.
3658 KB/s (709380260 bytes in 189.379s)

Copy files from local drive to phone:

$ adb push Desktop/Music/1.mp3 /sdcard/Music

3923 KB/s (4020352 bytes in 1.000s)

Login to Android shell:

$ adb shell

$ adb logcat
$ adb bugreport
$ adb get-state
$ adb start-server
$ adb kill-server
$ adb forward tcp:6100 tcp:7100
$ adb shell ps -x
$ adb version
$ adb help

Setup Android sdk and adb

Setup SDK
Download Android SDK from
Linux (i386)

Extract Android SDK to /data.

$ tar –xvzf android –sdk_r11-linux_x86 -C /data/android-sdk

Setup Android SDK to user environment

$ cd
$ vi .bashrc

export PATH=${PATH}:/data/android-sdk/tools
export PATH=${PATH}:/data/android-sdk/platform-tools

To get platform-tools, you need to follow:
Download Eclipse
Step 3. Installing the ADT Plugin for Eclipse
Step 4. Adding Platforms and Other Components

Enable linux machine to connect Android phone

If you connect your android phone to linux machine by default, you will get:

$ adb devices
List of devices attached
???????????? no permissions

Turn on “USB Debugging” on your device.
On the device, go to the home screen, press MENU, select Applications > Development, then enable USB debugging.

Create android rule:

$ vi /etc/udev/rules.d/51-android.rules

Add your phone usb vendor ID:

# Samsung

List of Android usb vendor ID:

Verify adroid phone connected:

$ adb devices
List of devices attached
S58305ce1a513 device

Android set default install location to SD card

Connect your android phone to computer.
List device:

$ adb devices

Set default install location to SD card:

$ adb shell pm setInstallLocation 2

Android-x86 networking

Go to command:

Alt + F1

$ netcfg
$ ifconfig eth0 up
$ netcfg eth0 dhcp

Android-x86 mount system file

Go to command:

Alt + F1

$ mount -t ext3 /dev/block/sda1 /d

System file at:

$ cd /d

$ ls

Get android-x86 froyo source code

Using git to get android-x86 froyo source code:

$ mkdir ~/bin

$ curl > ~/bin/repo
$ chmod +x ~/bin/repo
$ export PATH=$PATH:~/bin/
$ repo init -u git:// -b froyo-x86
$ repo sync

ubuntu 10.10 compile Android-x86 Froyo


$ sudo vi /etc/apt/sources.list

deb maverick partner
deb-src maverick partner

$ sudo apt-get update

Install require packages:

$ sudo apt-get -y install git-core gnupg flex bison gperf libsdl-dev libesd0-dev 

libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev libc6-dev-i386
g++-multilib lib32z1-dev lib32ncurses5-dev libx11-dev gcc-multilib ia32-libs
x11proto-core-dev libx11-dev lib32readline5-dev lunch sun-java6-jdk curl


$ nano ~/.bashrc


export JAVA_HOME=/usr/lib/jvm/java-6-sun


Download Android-x86 source code

$ cd

$ mkdir ~/bin
$ curl > ~/bin/repo
$ chmod +x ~/bin/repo
$ export PATH=$PATH:~/bin/
$ mkdir froyo
$ cd froyo
$ repo init -u git:// -b froyo-x86
$ repo sync


$ chmod +x build/

$ source build/
$ lunch
$ make iso_img TARGET_PRODUCT=generic_x86