ADB tools for Android device and simulator communication (i)

Source: Internet
Author: User

ADB tools for Android device and simulator communication (i)

tags (space delimited): Android

ADB is a must-know tool for Android development, which comes from the SDK package. All the brush machine tools, application management tools are referenced by the ADB tool. It can accomplish many functions. It is important to master the method of use of ADB. The ADB tool is also updated with the Android SDK update. We need to constantly update our understanding of the ADB.

  • Introduction to ADB commands
  • Commonly used adb command usage
  • Using ADB commands and recording videos
Introduction to ADB commands

An important command that contains the Android emulator operation under the Platform-tools folder of the SDK Adb,adb is all called Android Debug Bridge, which is the role of the debug bridges, and with this tool we can manage the state of the device or phone simulator.

Commonly used adb command usage
  • Managing devices with ADB commands
  • ADB self-management
  • Get Device hardware Information
  • Manage Device Apps
  • Working with files
  • Other commands
1. ADB Command Management Device
Command function
ADB get-state Determine Device status
ADB devices Show devices connected to the computer
ADB Get-serialno Get the serial number of the device
ADB reboot Restarting the device
ADB reboot bootloader Restarting the device into FastBoot mode
ADB reboot Recovery Restarting the device into recovery mode
ADB [-d|-e|-s <serialNumber>] <command> Send command to specified device
Determine Device status
> C:\Users\Administrator>adb get-state> unknown

View parameters, there are 3 main
ADB Get-state-prints:offline | bootloader | Device

Get the serial number of the device
只有一台设备的时候,可以直接获取:> C:\Users\Administrator>adb get-serialno> fc2f9754连接手机后:C:\Users\Administrator>adb devicesList of devices attachedfc2f9754        device

Which fc2f9754 refers to the serial number
deviceRefers to the status of the device, online

Enter ADB shell
C:\USERS\ADMINISTRATOR&GT;ADB devices* Daemon notRunning. StartingitNowOn   Port 5037 ** Daemon started successfully *list ofDevices attachedfc2f9754 deviced51ad9ff Device//Multiple devices, is unable to directly obtain the serial numberC:\users\administrator>adbGet-serialnounknown//Multiple devices, unable to enterC:\users\administrator>adbShellError:more than OneDevice andEMULATORC:\USERS\ADMINISTRATOR&GT;ADB deviceslist ofDevices attachedfc2f9754 deviced51ad9ff Device//At this point we can specify the serial number, enterC:\users\administrator>adb-s d51ad9ffShellShell@cancro:/$
adb [-d|-e|-s] Command

When there is a simulator and a real phone connection:

Enter simulator
C:\USERS\ADMINISTRATOR>ADB-E Shell

Enter the phone
c:\users\administrator>adb-d Shell

2. ADB's own management
Command function
ADB kill-server Terminate ADB service process
ADB start-server Restart ADB service Process
ADB root Restart ADB services with root privileges
notiton port 5037 ** daemon started successfully *//终止adb服务kill-server//以 root 权限重启 adb 服务 C:\Users\Administrator>adb root
3. Get Device hardware information
Command function
ADB Shell cat/sys/class/net/wlan0/address Get WiFi MAC Address
ADB Shell Cat/proc/cpuinfo Get CPU Information
ADB Shell Cat/system/build.prop Get device compilation properties (phone properties and phone configuration information)
ADB Shell cat/data/misc/wifi/*.conf Get WiFi configuration information
//获取手机连接网络的mac地址>C:\Users\Administrator>adb shell cat /sys/class/net/wlan0/address>0c:1d:af:47:06:d5
//获取 cpu 信息C:\Users\Administrator>adb shell cat /proc/cpuinfoProcessor       : ARMv7 Processor rev 3 (v7l)processor       : 0BogoMIPS        : 38.40processor       : 1BogoMIPS        : 38.40processor       : 2BogoMIPS        : 38.40processor       : 3BogoMIPS        : 38.40Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivtCPU implementer : 0x41CPU architecture: 7CPU variant     : 0x0CPU part        : 0xc07CPU revision    : 3Hardware        : Qualcomm MSM 8226 (Flattened Device Tree)Revision        : 0000Serial          : 0000000000000000
Get phone properties and phone configuration informationC:\USERS\ADMINISTRATOR&GT;ADB Shell Cat/system/build. Prop# Begin Build Properties# autogenerated by buildinfo.shRo. Build. ID=ktu84pro. Build. Display. ID=ktu84pro. Build. Version. Incremental=v6. 3. 5. 0. KHICNBLRo. Build. Version. SDK= +Ro. Build. Version. Codename=relro. Build. Version. Release=4.4. 4Ro. Build. Date=fri Feb -  the: +: ACst -Ro. Build. Date. UTC=1423811981Ro. Build. Type=userro. Build. User=builderro. Build. Host=zc-miui-ota-bd27. BJRo. Build. Tags=release-keysro. Product. Model=hm NOTE1Ltero. Product. Brand=xiaomiro. Product. Name=diorro. Product. Device=diorro. Product. Board=msm8226ro. Product. CPU. Abi=armeabi-v7aro. Product. CPU. Abi2=armeabi .... Post-configuration omitted ...
C:\Users\Administrator>adb shell cat /data/misc/wifi/*.conf> /system/bin/sh: cat: /data/misc/wifi/*.conf: Permission denied
4. Working with files
Command function
ADB Shell LS mnt View all device storage device names
ADB remount To re-mount the system partition as a read-write partition
ADB push <local> <remote> Copy files from local to device
ADB pull <remote> <local> Copy files from device to local
ADB Shell ls List the files and folders under the directory
ADB Shell CD <folder> Go to Folder
ADB Shell RM [-R] <path/filename> Delete file (clip)
ADB shell Cat <file> View File Contents
ADB shell mkdir path/foldername New Folder
5. Other commands
Command function
adb shell input Text <content> Send text content
ADB shell input KeyEvent <keycode> Send keyboard events
ADB shell WM Size Get Device resolution
ADB Shell Getprop <key> Get device parameter information
adb shell SetProp <key> <value> Setting device parameter information

Use adb command and record video to be continued ...

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

ADB tools for Android device and simulator communication (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.