android 命令行模式启动模拟器
2014-11-16 01:38
274 查看
启动模拟器需要两个步骤:
1.创建AVD(Android Virtual Device)
2.启动emulator
一般使用Eclipse开发时,开启一个模拟器就是这么一个过程,其实命令行模式下也是这样。刚开始不知道如何命令行启动模拟器的时候就输入了一个emulator,报错了,出现如下提示:
1.创建AVD
根据提示信息说明,需要先有一个AVD,即一个android的虚拟设备,在命令行输入android create avd,当然前提是在linux中配置好了环境变量,否则会出现找不到命令的错误提示的。如果环境变量配置正确会出现了错误提示信息:
根据上述所提到的参数,并通过查资料得到了-t --target参数如何获得。在命令行下输入android list target,显示如下:
其中的id:这一行就是我们需要的target的参数
如果启动的模拟器还需要sdcard的话,还需要首先创建一个sdcard的镜像
这样就很容易写出创建AVD的命令了
2.启动模拟器
首先通过android list avd 查看建好的虚拟设备
然后通过命令
就启动了第二个类型的模拟器。
其实用命令行启动模拟器和eclipse里启动是相同的。上面两个步骤就是对应eclipse中创建avd和启动模拟器的过程,使用eclipse创建avd,它会在家目录下建立.android的隐藏文件夹,将avd的信息全都放到这里面。
1.创建AVD(Android Virtual Device)
2.启动emulator
一般使用Eclipse开发时,开启一个模拟器就是这么一个过程,其实命令行模式下也是这样。刚开始不知道如何命令行启动模拟器的时候就输入了一个emulator,报错了,出现如下提示:
emulator: ERROR: You did not provide the name of an Android Virtual Device with the '-avd <name>' option. Read -help-avd for more information. If you *really* want to *NOT* run an AVD, consider using '-data <file>' to specify a data partition image file (I hope you know what you're doing).
1.创建AVD
根据提示信息说明,需要先有一个AVD,即一个android的虚拟设备,在命令行输入android create avd,当然前提是在linux中配置好了环境变量,否则会出现找不到命令的错误提示的。如果环境变量配置正确会出现了错误提示信息:
Error: The parameters --name, --target must be defined for action 'create avd' Usage: android [global options] create avd [action options] Global options: -s --silent Silent mode: only errors are printed out. -h --help Help on a specific command. -v --verbose Verbose mode: errors, warnings and informational messages are printed. Action "create avd": Creates a new Android Virtual Device. Options: -c --sdcard Path to a shared SD card image, or size of a new sdcard for the new AVD -s --skin Skin for the new AVD -a --snapshot Place a snapshots file in the AVD, to enable persistence. -n --name Name of the new AVD [required] -p --path Directory where the new AVD will be created -t --target Target ID of the new AVD [required] -f --force Forces creation (overwrites an existing AVD)
根据上述所提到的参数,并通过查资料得到了-t --target参数如何获得。在命令行下输入android list target,显示如下:
android list target Available Android targets: id: 1 or "android-8" Name: Android 2.2 Type: Platform API level: 8 Revision: 2 Skins: WQVGA432, WQVGA400, HVGA, WVGA854, QVGA, WVGA800 (default)
其中的id:这一行就是我们需要的target的参数
如果启动的模拟器还需要sdcard的话,还需要首先创建一个sdcard的镜像
mksdcard -l sdcard 512M ~/xx/sdcard.img
这样就很容易写出创建AVD的命令了
android create avd -c ~/xxx/sdcard.img -n emulator2011 -p ~/test/ -t 1 -f
2.启动模拟器
首先通过android list avd 查看建好的虚拟设备
Available Android Virtual Devices: Name: android.2.2 Path: /home/XXX/.android/avd/android.2.2.avd Target: Android 2.2 (API level 8) Skin: HVGA --------- Name: emulator2011 Path: /home/XXX/test Target: Android 2.2 (API level 8) Skin: WVGA800 Sdcard: /home/XXX/sdcard.img
然后通过命令
emulator @emulator2011
就启动了第二个类型的模拟器。
其实用命令行启动模拟器和eclipse里启动是相同的。上面两个步骤就是对应eclipse中创建avd和启动模拟器的过程,使用eclipse创建avd,它会在家目录下建立.android的隐藏文件夹,将avd的信息全都放到这里面。
相关文章推荐
- android 命令行模式启动模拟器
- android 命令行模式启动模拟器
- Android 命令行模式启动模拟器
- android 命令行模式启动模拟器
- android 命令行模式启动模拟器
- android 命令行模式启动模拟器
- android eclipse里边怎么用命令行启动模拟器
- Android命令行启动模拟器
- 通过命令行模式读取Android模拟器的数据库
- Android命令行启动模拟器
- android命令行方式启动模拟器
- linux乱码解决以及启动默认进入命令行模式
- ubuntu 开机启动命令行模式
- Ubuntu 默认命令行模式启动的方法
- Ubuntu 10.10启动进入命令行模式
- Android Activity启动模式分析
- Android开发入门常见问题:模拟器启动及Eclipse报错
- Android开发入门常见问题:模拟器启动及Eclipse报错
- android开发之启动模拟器并安装游戏apk
- 实现linux的自动登录--命令行模式启动