欢迎您光临本小站。希望您在这里可以找到自己想要的信息。。。

linux下安卓模拟器安装

java water 4249℃ 0评论

今天在网上查询hipri网络连接的时候偶然看到了一位仁兄的评论:我只知道模拟器上的网络连接用的是hipri

正是这句话让我想起了在linux 上新建一个模拟器,用模拟器来做下CTS测试,于是呼便有了以下拙见:

1.首先将SDK的tools路径加到环境变量中去

进入root目录, 显示隐藏的文件,export PATH="/tools/android-sdk-linux/tools:$PATH"加入路径

2.显示SDK版本id

在终端输入命令android list target,显示的id在下面创建模拟器的时候要用到

3.创建模拟器

在终端输入命令android create avd -n testCTS -t 1,-n后面为模拟器名称,-t后面为上一步的SDK对应的id

 ./android create avd -n myphone01 -t 1 -b default/x86
-b 的选项有两种,如果是PC机器 default/x86 如果是其他用 default/armeabi-v7a


4.显示模拟器信息

命令:android list avd,显示模拟器信息说明创建成功

5.打开模拟器

命令:emulator @testCTS

./emulator64-arm @myphone01 -sdcard mysd01 -scale 0.8(区分32位和64位系统)

=======

When testing Android applications you have to rely on running the tests in the emulator or a device attached to your computer. However, if you want to follow a continuous integration workflow for Android development, you might need a headless emulator that runs in a non-graphical environment. For instance, I have been using Travis CI and Gradle for automating Android builds.

To completely avoid showing the emulator interface (headless emulator) you need to start the emulator with some options in your terminal.

First, you can create an specific Android AVD as follows:

1
android create avd –force -n test -t android-17 –abi armeabi-v7a

Then, to run the headless emulator:

1
emulator -avd test -no-skin -no-audio -no-window

The '-no-skin' option removes the emulator buttons such as the home and other hardware keyboard buttons.

The '-no-audio' option disables the audio support.

Finally, the '-no-window' option disables the emulator's graphical window display.

Now yo can use this emulator to run your tests.

=========

ubuntu或者别的linux系统安装安卓模拟器(Android SDK)的方法跟Windows差不多,今天安卓部落就教大家怎么样在ubuntu环境下安装安卓模拟器。

  首先下载Android SDK

  Android SDK官方下载地址:http://developer.android.com/sdk/index.html

  进入网站后 点击底下的DOWNLOAD FOR OTHER PLATFORMS

  注意这里有两个版本,上面一个包含了eclipse和Android SDK,底下一个就只是安卓模拟器Android SDK的安装包,一般来说如果你不打算开发安卓软件的话,就下载下面一个吧,记得分清除32-bit和64-bit的版本。

  将下载好的adt-bundle-linux-x86_64.zip复制到虚拟机的主目录里面,也可以直接在ubuntu环境下载。

 

  解压缩文件

  解压缩成功后,进入adt-bundle-linux-x86_64/sdk/tools目录

  右键打开终端

  然后输入命令 ./android 启动Android SDK Manager

  勾中Tools和Android 4.2(API 17),还可以安装以前的Android 4.1.2或者2.3版本,一般我们选择最新版本就好了,因为选择的版本越多下载时间就越长。

  选中后,点击右下角的Install 5 packages…

  这时就开始在线下载文件了,时间会比较长,中途如果弹出错误窗口也不用管,等待下载完成。

  跟windows环境安装安卓模拟器不一样,linux环境下需要用命令来建立模拟器。

  首先在终端中输入

  ./mksdcard 512M mysd01

  上面的512M是指虚拟机的SD卡大小,mysd01是指卡的名称,大小和名称可以更改为别的。

  ./android create avd -n myphone01 -t 2

  创建虚拟手机设备,这里的myphone01是指虚拟机名称,也可以更改。

  出现上面这种提示就表示模拟器建立好了

  Auto-selecting single ABI armeabi-v7a

  Created AVD 'myphone01' based on Google APIs (Google Inc.), ARM (armeabi-v7a) processor,

  with the following hardware config:

  hw.lcd.density=240

  vm.heapSize=48

  hw.ramSize=512

  最后运行模拟器

  sudo ./emulator @myphone01 -sdcard mysd01 -scale 0.8

  输入上面的命令就可以在ubuntu环境下运行安卓模拟器了,由于要录制视频教程,所以后面几步没有办法截图,不懂的就看看上面的视频教程吧。

转载请注明:学时网 » linux下安卓模拟器安装

喜欢 (4)or分享 (0)

您必须 登录 才能发表评论!