AzimoLabs / fastlane-plugin-automated-test-emulator-run

Plugin dedicated for Android platform. Wraps gradle task/shell command used for launching instrumented tests. Provides start of as many AVDs with various configs as needed before test run, waits for boot, kills emulators and deletes them from hdd after tests are finished or disturbed.
MIT License
113 stars 48 forks source link

avd error #20

Open ir2pid opened 6 years ago

ir2pid commented 6 years ago

my avd config file:

{ "avd_list": [ { "avd_name": "EM1", "create_avd_package": "system-images;android-24;google_apis;x86", "create_avd_device": "EM1", "create_avd_tag": "google_apis", "create_avd_abi": "x86", "create_avd_additional_options": "AVD_recreate_new false", "create_avd_hardware_config_filepath": "~/.android/avd/EM1.avd/config.ini", "launch_avd_port": "2557", "launch_avd_snapshot_filepath": "~/.android/avd/EM1.avd/config.ini/EM1_SNAPSHOT.img", "launch_avd_launch_binary_name": "emulator2", "launch_avd_additional_options": "-gpu on" } ] }

I get error:


[17:36:44]: AVD with name 'EM1' does not exist. Creating new AVD.
[17:36:44]: $ echo "no" | /Users/sdutta/Library/Android/sdk/tools/bin/avdmanager create avd --name "EM1" --package "system-images;android-24;google_apis;x86" --device "EM1" --tag google_apis --abi x86 
[17:36:45]: ▸ Error: No device found matching --device EM1.
[17:36:45]: ▸ null
+------------------+--------------------+
|             Lane Context              |
+------------------+--------------------+
| DEFAULT_PLATFORM | android            |
| PLATFORM_NAME    | android            |
| LANE_NAME        | android fastscreen |
+------------------+--------------------+
[17:36:46]: Exit status of command 'echo "no" | /Users/sdutta/Library/Android/sdk/tools/bin/avdmanager create avd --name "EM1" --package "system-images;android-24;google_apis;x86" --device "EM1" --tag google_apis --abi x86 ' was 1 instead of 0.
Error: No device found matching --device EM1.
null
FisherKK commented 6 years ago

Hello. I don't get what EM1 device is.

Please navigate to your sdk_home location then to directory tools/bin and use avdmanager in terminal to read available devices that can be used in create_avd_device field:

$ ./avdmanager list device

I would also recommend creating your AVD via Android Studio first with config you wish to have. Then inspect it config.ini in ~/.android/avd/<your_avd_name> directory and see what value does device field has. Then use it in script!

Write if you have any more problems :)

ir2pid commented 6 years ago

hey, copying the .ini and cache.img file makes it work now thanks!

another thing, I start 3 emulators but the screenshots work on one, rest are idle.

attaching my json:

{
  "avd_list": [
    {
      "avd_name": "Pixel_XL_API_24",
      "create_avd_package": "system-images;android-24;google_apis;x86",
      "create_avd_device": "pixel_xl",
      "create_avd_tag": "google_apis",
      "create_avd_abi": "x86",
      "create_avd_additional_options": "",
      "create_avd_hardware_config_filepath": "/Users/xx/android/fastlane/pixel_xl.ini",
      "launch_avd_port": "",
      "launch_avd_snapshot_filepath": "/Users/sdutta/xx/fastlane/cache.img",
      "launch_avd_launch_binary_name": "emulator",
      "launch_avd_additional_options": "-gpu on"
    },
    {
      "avd_name": "Nexus_7_API_24",
      "create_avd_package": "system-images;android-24;google_apis;x86",
      "create_avd_device": "Nexus 7 2013",
      "create_avd_tag": "google_apis",
      "create_avd_abi": "x86",
      "create_avd_additional_options": "",
      "create_avd_hardware_config_filepath": "/Users/xx/android/fastlane/nexus7.ini",
      "launch_avd_port": "",
      "launch_avd_snapshot_filepath": "/Users/sdutta/xx/android/fastlane/cache.img",
      "launch_avd_launch_binary_name": "emulator",
      "launch_avd_additional_options": "-gpu on"
    },
    {
      "avd_name": "Nexus_10_API_24",
      "create_avd_package": "system-images;android-24;google_apis;x86",
      "create_avd_device": "Nexus 10",
      "create_avd_tag": "google_apis",
      "create_avd_abi": "x86",
      "create_avd_additional_options": "",
      "create_avd_hardware_config_filepath": "/Users/xx/android/fastlane/nexus10.ini",
      "launch_avd_port": "",
      "launch_avd_snapshot_filepath": "/Users/xx/android/fastlane/cache.img",
      "launch_avd_launch_binary_name": "emulator",
      "launch_avd_additional_options": "-gpu on"
    }
  ]
}

my lane:


  desc "Runs tests with AVD setup according to JSON file config with usage of other lane."
  lane :fastscreen do
      automated_test_emulator_run(
        AVD_recreate_new:false,
        AVD_clean_after:false,
        AVD_setup_path: "/Users/sdutta/Workspace/mobile/skoobe-app/platform/android/fastlane/AVD_setup.json",
        shell_task:"fastlane screenshots"
      )
   end

can you help me with running screenshots on all 3