How to Use Android ADB Command Line Tool on mac

本文详细介绍了如何安装、配置及使用Android Debug Bridge (ADB) 命令行工具来管理Android设备,包括安装应用、复制文件、执行Linux shell命令等常用操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://www.londatiga.net/it/how-to-use-android-adb-command-line-tool/


How to Use Android ADB Command Line Tool

width="300" height="250" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" id="aswift_0" name="aswift_0" style="box-sizing: border-box; max-width: 100%; left: 0px; position: absolute; top: 0px;">

Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Android phone. ADB is bundled with Android SDK package that can be downloaded from Android SDK download page. This tool is usefull for communicating with Android phone such as install application, copy files from/to device and perform some linux shell commands.

How to Install

  • Download and install Java SDK (Ex:jdk-6u20-windows-i586.exe)
  • Download Android SDK package (Ex:android-sdk_r06-windows.zip)
  • Extract SDK package into anywhere on your drive (Ex: D:\android-sdk-windows)

Phone Setup

In order to use ADB, you have to enable USB Debugging option in  phone settings (Settings->Applications->Development)

How to Use

  • Connect the phone to your pc/notebook usb port
  • Run Windows command line tool (cmd) and go to D:\android-sdk-windows\tool

Update!!

New Android SDK puts adb executable file on \platform-tools directory instead of tool. So the path should be D:\android-sdk-windows\platform-tools

Usefull Commands

1. Check connected phone

Syntax: adb devices

2. Login to Android shell

Syntax: adb shell

Note:

If you get ‘#’ after typing adb shell, you are already get root access on the phone, no need to type su. Otherwise if you get ‘$’ , type ‘su’ to get root access (only for rooted device).

3. Some usefull shell commands

    • ls

List directory

Syntax:  ls [path]

Example:

#ls /system/lib

    • cp

Copy file or directory

Syntax: cp [options] source dest

Note:

To copy or delete files in Android root directories you have to change the directory access mode to ‘read and write (rw)’ using command: remount rw

Example:

#remount rw

#cp /sdcard/libsec-ril.so /system/lib

#remount ro

    • mv

Move file or directory

Syntax: mv [options] source dest

Example:

#mv /system/lib/libsec-ril.so /sdcard/backup

    • chmod

Change file/directory permission

Syntax: chmod [-R] mode[,mode] …. file

Example:

#chmod 0644 /system/lib/libsec-ril.so

    • rm

Remove file or directory

Syntax: rm [options] file

Example:

#rm /system/lib/libsec-ril.so

4. Install application

width="468" height="60" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowfullscreen="true" id="aswift_1" name="aswift_1" style="box-sizing: border-box; max-width: 100%; left: 0px; position: absolute; top: 0px;">

You can use adb to install aplication from your local drive into  phone.

Syntax: adb install appname.apk

Example:

D:\android-sdk-windows\tools\adb install D:\AnReboot.apk

5. Copy files from phone to local drive

Syntax: adb pull source [destination]

Example:

D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip

D:\android-sdk-windows\tools\adb pull /sdcard/arm11-dvm.zip D:\

6. Copy files from local drive to phone

Syntax: adb push source destination

Example:

D:\android-sdk-windows\tools\adb push D:\AnReboot.apk /sdcard


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值