我试图使用TeamCity在一个特定的模拟器上安装一个apk。现在我正在启动一个模拟器,成功地安装apk。但是,如果模拟器已经有一个或多个实例正在运行,teamcity无法决定在哪个模拟器中安装apk (即使在我从工作组城市脚本启动模拟器时也是如此)。
问题是,我无法识别我刚刚开始使用的模拟器:
emulator -adv myEmulator它将在端口5554至5587之间启动一个模拟器.我知道可以在要安装apk的地方设置模拟器实例:
adb -s emulator-5554 install path/apk但是我不知道我刚刚启动的模拟器的id,所以它的名称在这个范围内可以有任何数字。
我知道我可以将UUID设置为仿真器(从这里),但是再次。不知道怎么用那个uuid。
现在,在使用批处理运行自己的模拟器之前,我将尝试保存可用的模拟器,然后比较这两个数组以获得我的模拟器。但我不是批处理专家..。所以如果有人有线索的话,
问候
发布于 2014-08-08 13:02:24
你似乎在寻找-s的adb选项
-s <specific device> - directs command to the device or emulator with
the given serial number or qualifier.其他有用的选择:
-d - directs command to the only connected USB device
returns an error if more than one USB device is
present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is
running.通常情况下,adb -h可以看到他们的全部。
编辑
您可以定义您希望模拟器使用的端口:
-ports <consoleport>,<adbport> TCP ports used for the console and adb bridge因此,您可以手动分配端口,而不必费心猜测。为了避免端口冲突,您可以强制所有启动的仿真器的端口(通常不应该超过3个同时运行),或者您可以为您的范围选择高的端口号,足够高以至于即使启动了任何其他模拟器,它也将使用低于您范围的可用端口。
或者,您可以解析在与-verbose开关一起使用时生成的模拟器日志,因为您可以在那里找到:
emulator: control console listening on port 5554, ADB on port 5555
emulator: sent '0012host:emulator:5555' to ADB server如果要将模拟器日志保存到特定文件,请使用常规流重定向:
emulator -verbose @MyAVD > log.txthttps://stackoverflow.com/questions/25204129
复制相似问题