Linux Scroll

Just another WordPress.com 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
Success

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
Success

Uninstall apk:

$ adb uninstall com.android.email

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
Advertisements

Setup Android sdk and adb

Setup SDK
Download Android SDK from http://developer.android.com/sdk/index.html
Linux (i386)
android-sdk_r11-linux_x86.tgz

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

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

To get platform-tools, you need to follow:
http://developer.android.com/sdk/installing.html
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:

# HTC
SUBSYSTEM=="usb",SYSFS{idVendor}=="0bb4",MODE="0666"
# Samsung
SUBSYSTEM=="usb",SYSFS{idVendor}=="04e8",MODE="0666"

List of Android usb vendor ID:
http://developer.android.com/guide/developing/device.html

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 http://android.git.kernel.org/repo > ~/bin/repo
$ chmod +x ~/bin/repo
$ export PATH=$PATH:~/bin/
$ repo init -u git://git.android-x86.org/manifest.git -b froyo-x86
$ repo sync

ubuntu 10.10 compile Android-x86 Froyo

Unmark:

$ sudo vi /etc/apt/sources.list

deb http://archive.canonical.com/ubuntu maverick partner
deb-src http://archive.canonical.com/ubuntu 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

Edit:

$ nano ~/.bashrc

Add:

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

export ANDROID_JAVA_HOME=$JAVA_HOME

Download Android-x86 source code

$ cd

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

Build

$ chmod +x build/envsetup.sh

$ source build/envsetup.sh
$ lunch
$ make iso_img TARGET_PRODUCT=generic_x86