在Eclipse中,任何方式在同一时间启动多个仿真应用程序? [英] In Eclipse, any way to start application in more than one emulator at the same time?

查看:99
本文介绍了在Eclipse中,任何方式在同一时间启动多个仿真应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在测试Android的布局,我一直在打造了三种不同的模拟器在Eclipse(与ADT),所以我要跑三次,然后选择每一个。有没有可以让我preSS运行一次的任何配置或插件和应用程序在所有三个开始了吗?

When testing Android layouts, I'm constantly building for three different emulators from Eclipse (with ADT), so I have to run three times and then select each one. Is there any configuration or plugin that allows me to press Run once and the application is started in all three?

推荐答案

我终于做到了。我在一台Mac的环境,所以我用的AppleScript简化设置一些变量,但是这是可以实现直接从终端。

I've finally done it. I'm on a Mac environment so I used Applescript to simplify setting some variables, but this is achievable straight from the terminal.

set apkref to "install -r /path/to/your/app.apk"
set appref to "shell am start -a android.intent.action.MAIN -n
com.example.app/com.example.app.MainActivity"
set sourceref to "/path/to/android/tools/"

set devices to do shell script sourceref & "adb devices |  grep \"[device]$\" | 
sed  's/.device/\\ /' | sed  's/^/\\adb -s /' | sed  's@$@\\" & apkref &
" \\&" & "@' | sed  's@^@\\" & sourceref & "@' 
| sed -E -e :a -e '$!N; s/\\n/ /g; ta'"
do shell script devices

set devices to do shell script sourceref & "adb devices |  grep \"[device]$\" | 
sed  's/.device/\\ /' | sed  's/^/\\adb -s /' | sed  's@$@\\" & appref & 
" \\&" & "@' | sed  's@^@\\" & sourceref & "@' 
| sed -E -e :a -e '$!N; s/\\n/ /g; ta'" 
do shell script devices

正如你可以看到我只是在一些运行shell命令。实现的sed的这种特殊拼接是一种痛苦,但一个很好的学习经验。

As you can see I'm just running some shell commands. Achieving this specific concatenation of sed's was a pain, but a great learning experience.

第一个shell脚本将在所有亚行的设备中发现的设备上安装APK。如果应用程序已经存在,其亚行重新安装,由于-r标志。我连接具有与放大器的命令;所以每个命令在后台运行,并安装在同一时间运行。 previously我试图与功放连接起来的命令;&安培;,因此每个命令等待轮到,结果是一个非常缓慢的过程。

The first shell script will install the apk in all the devices found through adb devices. If the app's already there, adb reinstalls it due to the -r flag. I concatenate the commands with & so each command runs in the background, installing and running at the same time. Previously I tried concatenating the commands with &&, so each command waited for its turn and the result was a much slower process.

第二个shell脚本将在所有设备上运行的应用程序。

The second shell script will run the app in all the devices.

我敢肯定,这可以通过某人的sed的更多知识进行简化,但它为我的伟大工程。

I'm sure this can be simplified by someone with greater knowledge of sed, but it works great for me.

,我继续创建的Automator应用程序做到这一点,每个设备(所以当我Ctrl + C一颗颗logcat中,就开始下一个)。

Inspired by this little experience, I went ahead and created Automator applications to do this and run adb logcat on each device (so when I ctrl+c out of one logcat, it starts the next one).

我竟然创造服务来运行这个应用程序的Automator,但在Mac OS X Eclipse不支持服务。解决方法是运行应用程序的外部工具。

I went so far as to create Services to run this Automator apps, however Eclipse in Mac OS X doesn't support Services. The workaround was to run the apps as External Tools.

有关额外的味道,我加了咆哮的通知我的Automator应用程序来告诉我,当亚行安装和运行应用程序。

For extra flavour, I added Growl notifications in my Automator apps to tell me when adb is installing and running the app.

这篇关于在Eclipse中,任何方式在同一时间启动多个仿真应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆