Android-ADB命令常用方法

     Android 命令提供了SDK版本的查看、更新,虚拟机的创建、修改、删除以及Android项目的创建编译以及打包,是Android开发中重要的命令。

        我们要使用ADB,第一件事情就是学会使用Android的常用命令。

1、查看目前可用的Android平台:
    android list targets

C:\Windows\System32>android list targets
Available Android targets:
----------
id: 1 or "android-10"
Name: Android 2.3.3
Type: Platform
API level: 10
Revision: 2
Skins: WVGA800 (default), WVGA854, WQVGA400, WQVGA432, HVGA, QVGA
Tag/ABIs : default/armeabi, default/x86
----------
id: 2 or "Google Inc.:Google APIs:10"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 2
Description: Android + Google APIs
Based on Android 2.3.3 (API level 10)
Libraries:
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WVGA854, WVGA800 (default), WQVGA432, HVGA, QVGA, WQVGA400
Tag/ABIs : default/armeabi

2、显示系统中的全部AVD(Android Virtual Drvice)
    android list avd
C:\Windows\System32>android list avd
Available Android Virtual Devices:
Name: Intel
Device: 3.2in QVGA (ADP2) (Generic)
Path: C:\Users\小敏\.android\avd\Intel.avd
Target: Android 2.3.3 (API level 10)
Tag/ABI: default/x86
Skin: 320x480
Sdcard: 512M
---------
Name: Test
Path: C:\Users\小敏\.android\avd\Test.avd
Target: Android 2.3.3 (API level 10)
Tag/ABI: default/x86
Skin: WVGA800

3、创建AVD

Creates a new Android Virtual Device.
Options:
-g --tag : The sys-img tag to use for the AVD. The default is to
auto-select if the platform has only one tag for its system
images.
-c --sdcard : 新的SD卡的大小或者老的SD卡的路径. 
-n --name : AVD的名称. [required]
-a --snapshot: 快照文件路径.
-p --path : 虚拟机的存放路径.
-f --force : 强制创建(覆盖已存在的AVD)
-s --skin : AVD的皮肤.
-t --target : 虚拟机的Android操作系统ID,也就是上面那个命令的“id: 1 or "android-10"”. [required] 
-b --abi : The ABI to use for the AVD. The default is to auto-select the
ABI if the platform has only one ABI for its system images.
-d --device : The optional device definition to use. Can be a device index
or id.

    例如:android create avd --name ${avd名称} --target ${平台编号} --abi ${cpu平台}
    eg: android create avd --name Test --target 1 --abi x86

C:\Windows\System32>android create avd --name Test --target 1 --abi x86 -f
Android 2.3.3 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Created AVD 'Test' based on Android 2.3.3, Intel Atom (x86) processor,
with the following hardware config:
hw.lcd.density=240
hw.ramSize=256
vm.heapSize=24
C:\Windows\System32>android list avd
Available Android Virtual Devices:
Name: Intel
Device: 3.2in QVGA (ADP2) (Generic)
Path: C:\Users\小敏\.android\avd\Intel.avd
Target: Android 2.3.3 (API level 10)
Tag/ABI: default/x86
Skin: 320x480
Sdcard: 512M
---------
Name: Test
Path: C:\Users\小敏\.android\avd\Test.avd
Target: Android 2.3.3 (API level 10)
Tag/ABI: default/x86
Skin: WVGA800

4、删除AVD
    android delete avd -n Test 
C:\Windows\System32>android delete avd -n Test
Deleting file C:\Users\小敏\.android\avd\Test.ini
Deleting folder C:\Users\小敏\.android\avd\Test.avd
AVD 'Test' deleted.

5、启动AVD
    emulator -avd Test

6、其他命令请使用android -h进行查阅:
C:\Windows\System32>android -h
Usage:
android [global options] action [action options]
Global options:
-h --help : Help on a specific command.
-v --verbose : Verbose mode, shows errors, warnings and all messages.
--clear-cache: Clear the SDK Manager repository manifest cache.
-s --silent : Silent mode, shows errors only.
Valid
actions
are
composed
of a verb
and an
optional
direct
object:
- sdk : Displays the SDK Manager window.
- avd : Displays the AVD Manager window.
- list : Lists existing targets or virtual devices.
- list avd : Lists existing Android Virtual Devices.
- list target : Lists existing targets.
- list device : Lists existing devices.
- list sdk : Lists remote SDK repository.
- create avd : Creates a new Android Virtual Device.
- move avd : Moves or renames an Android Virtual Device.
- delete avd : Deletes an Android Virtual Device.
- update avd : Updates an Android Virtual Device to match the folders
of a new SDK.
- create project : Creates a new Android project.
- update project : Updates an Android project (must already have an
AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must
already have an AndroidManifest.xml).
- create lib-project : Creates a new Android library project.
- update lib-project : Updates an Android library project (must already have
an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb : Updates adb to support the USB devices declared in the
SDK add-ons.
- update sdk : Updates the SDK by suggesting new platforms to install
if available.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值