[英]create 3 android emulators [phone, tab7, tab10] and start them via commandline for fastlane
I'm working on fastlane and want to start 3 emulators [phone, tab7, tab10] and take screenshots on them.我正在开发 fastlane 并想启动 3 个模拟器 [phone、tab7、tab10] 并对其进行截图。
How do I create a script to create and start emulators via fastlane or commandline如何创建脚本以通过 fastlane 或命令行创建和启动模拟器
You will need a script which does the following:您将需要一个执行以下操作的脚本:
Then you call the script for your three different screen sizes.然后为三种不同的屏幕尺寸调用脚本。
Some more details:更多细节:
To start the emulator use the program emulator
which is located under android-sdk/emulator/emulator
.要启动仿真器使用程序
emulator
位于下android-sdk/emulator/emulator
。 I had problems with android-sdk/tools/emulator
so be sure to use the right one.我在使用
android-sdk/tools/emulator
遇到了问题,所以一定要使用正确的。 The call can look like this:调用可能如下所示:
emulator @'your_emulator_name_variable' &
The &
is important when you are using a shell script to continue after the call.当您使用 shell 脚本在调用后继续时,
&
很重要。
You can call adb shell getprop sys.boot_completed
to see if the emulator has booted already.您可以调用
adb shell getprop sys.boot_completed
来查看模拟器是否已经启动。 Do this in a loop until it returns 1
在循环中执行此操作,直到它返回
1
Call fastlane screengrab and append the specific type flag:调用 fastlane screengrab 并附加特定类型标志:
--specific-type 'device_type_variable'
with 'device_type_variable'
equals to phone
, sevenInch
or tenInch
. 'device_type_variable'
等于phone
、 sevenInch
或tenInch
。 According to the emulator you started.根据您启动的模拟器。
Call adb emulator-5554 emu kill
to shut down you emulator.调用
adb emulator-5554 emu kill
关闭模拟器。 If it uses another, non standard port, adjust accordingly.如果它使用另一个非标准端口,请相应调整。
Now you can call this script with the two variables your_emulator_name_variable
and device_type_variable
for each of your emulator.现在,您可以使用每个模拟器的两个变量
your_emulator_name_variable
和device_type_variable
调用此脚本。
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.