简体   繁体   中英

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.

How do I create a script to create and start emulators via fastlane or commandline

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 . I had problems with android-sdk/tools/emulator so be sure to use the right one. 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.

  2. You can call adb shell getprop sys.boot_completed to see if the emulator has booted already. Do this in a loop until it returns 1

  3. Call fastlane screengrab and append the specific type flag:
    --specific-type 'device_type_variable'
    with 'device_type_variable' equals to phone , sevenInch or tenInch . According to the emulator you started.

  4. Call adb emulator-5554 emu kill to shut down you emulator. 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.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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