简体   繁体   English

创建 3 个 android 模拟器 [phone, tab7, tab10] 并通过命令行启动它们以用于 fastlane

[英]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:您将需要一个执行以下操作的脚本:

  1. Start the emulator启动模拟器
  2. Wait for the emulator to boot等待模拟器启动
  3. Start screengrab for this emulator启动此模拟器的屏幕截图
  4. Shut down the emulator关闭模拟器

Then you call the script for your three different screen sizes.然后为三种不同的屏幕尺寸调用脚本。

Some more details:更多细节:

  1. 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 脚本在调用后继续时, &很重要。

  2. 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

  3. 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'等于phonesevenInchtenInch According to the emulator you started.根据您启动的模拟器。

  4. 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_variabledevice_type_variable调用此脚本。

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM