UsingAdb


Adb Introduction

Adb is short for Android Debug Bridge which is a versatile tool lets you manage the state of an emulator instance or Android-powered device. The adb tool provide many functions, some useful functions will be listed at adb common features. For detailed information about adb, please take http://developer.android.com/guide/developing/tools/adb.html as a reference.

Adb Setup

Adb is a component included in the Android SDK. After you setup the Android SDK, the adb tool need to be added into SDK. The following is the brief guide about how to setup adb on Windows XP and Ubuntu 10.04. For other platforms, please take installing the SDK as a reference.

Setup SDK on Windows

  • Get the windows Android SDK android-sdk_r16-windows.zip at: http://developer.android.com/sdk/index.html
  • Extract this archive to local disk
  • Install platform tools of Android SDK
    • Enter the <Android_SDK_DIR> with windows XP command window
    • Run the SDK Manager.exe to startup the Android SDK Manager
    • Install Android SDK platform-tools
    • After you install Android SDK platform-tools, the adb tool will be included
  • Enter platform-tools and execute adb.exe to list help message
    Android_SDK_DIR> adb.exe
    Android Debug Bridge version 1.0.29
    
     -d                            - directs command to the only connected USB device
                                     returns an error if more than one USB device is present.
     -e                            - directs command to the only running emulator.
                                     returns an error if more than one emulator is running.
      ... ... ... ... ... ...
    scripting:
      adb wait-for-device          - block until device is online
      adb start-server             - ensure that there is a server running
      adb kill-server              - kill the server if it is running
      adb get-state                - prints: offline | bootloader | device
      adb get-serialno             - prints: <serial-number>
      adb status-window            - continuously print device status for a specified device
      adb remount                  - remounts the /system partition on the device read-write
      adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
      adb reboot-bootloader        - reboots the device into the bootloader
      adb root                     - restarts the adbd daemon with root permissions
      adb usb                      - restarts the adbd daemon listening on USB
      adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
      ... ... ... ... ... ...
       

Setup SDK on Ubuntu 10.04

  • Getting the Linux Android SDK android-sdk_r16-linux.tgz at: http://developer.android.com/sdk/index.html
  • Extract this archive to local disk.
  • Install platform tools of Android SDK.
       $ cd <Android_SDK_DIR>/tools
       $ ./android
       select Android SDK platform tools and click install packags
       $ cd <Android_SDK_DIR>/platform-tools
       $ ./adb
    Android Debug Bridge version 1.0.29
    
     -d                            - directs command to the only connected USB device
                                     returns an error if more than one USB device is present.
     -e                            - directs command to the only running emulator.
                                     returns an error if more than one emulator is running.
      ... ... ... ... ... ...
    scripting:
      adb wait-for-device          - block until device is online
      adb start-server             - ensure that there is a server running
      adb kill-server              - kill the server if it is running
      adb get-state                - prints: offline | bootloader | device
      adb get-serialno             - prints: <serial-number>
      adb status-window            - continuously print device status for a specified device
      adb remount                  - remounts the /system partition on the device read-write
      adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
      adb reboot-bootloader        - reboots the device into the bootloader
      adb root                     - restarts the adbd daemon with root permissions
      adb usb                      - restarts the adbd daemon listening on USB
      adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
      ... ... ... ... ... ...
       

Adb Usage

Adb Common Functions

The main functions used frequently are listed as below
  • Use adb to install .apk application: adb install *.apk
  • Use adb to push file into Android-powered device: adb push <file_name> <android_path>
  • Use adb to pull file to local: adb pull <android_path/file_name> <local_path/file_name>
  • Use adb to login the Android shell: adb shell

Use Adb With EK Board

The following is the brief guide using adb with EK board.
  • On Windows XP
    • Connect host PC with EK board through USB cable. If you first use, it will ask to install the adb driver.
    • Enter the <Android_SDK_DIR\platform-tools> with windows XP command window.
    • Excute android.bat update adb, after this operation, you will get adb_usb.ini file under your $WINDOWS_HOME\.android directory.
    • Edit adb_usb.ini file and add 0x03EB to this file.
    • Under <Android_SDK_DIR\platform-tools> and excute adb kill-server to kill the adb server, and then restart the adb server with adb start-server
    • Use the adb features list at adb common features

  • On Ubuntu 10.04
    • Connect host PC with EK board through USB cable.
    • Enter the <Android_SDK_DIR/platform-tools> with console.
    • Excute ./android update adb, after this operation, you will get adb_usb.ini file under your $HOME/.android directory.
    • Edit adb_usb.ini file and add 0x03EB to this file.
    • Under <Android_SDK_DIR/platform-tools> and excute ./adb kill-server to kill the adb server, and then restart the adb server with ./adb start-server
    • Use the adb features list at adb common features

TIP For more detail information about Adb, please take http://developer.android.com/guide/developing/tools/adb.html as a reference.

r12 - 30 Jul 2014 - 08:11:02 - VoiceShen
 
Android4SAM

Copyright by the contributing authors. All material on the platform is the property of the contributing authors.

Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions

Atmel and others, are registered trademarks or trademarks of Atmel or its subsidiaries.This site is powered by the TWiki collaboration platform

ARM and others are registered trademarks or trademarks or ARM Ltd. Other terms and product names may be trademarks of others.

Under the terms of the Creative Commons Attribution License

Syndicate this siteRSS ATOM