Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVD and Emulator: what parameters do I need to define a skin-supported device? #213

Open
myThorsten opened this issue Aug 18, 2020 · 1 comment

Comments

@myThorsten
Copy link

First of all, thank you for this great project :)

What are the parameters I have to give the AVD / the Emulator in order for screenshots to find the emulator and attach a skin?

I can do this no problem with Android Studio, but now I want to migrate to gitlab-runner. I managed to install an AVD and start an emulator, but screenshots cannot match it. This is what I have:

AVD and emulator

avdmanager --verbose create avd --force --name "Android_Emulator_API_28" --device "Nexus 6P" --package "system-images;android-28;google_ndk;x86"
emulator -avd Android_Emulator_API_28 -no-audio -no-boot-anim -no-window -accel auto -gpu off -memory 1024 &

Case 1:

  • screenshots.yaml: Nexus 6P
  • Output of screenshots: No device attached or emulator installed for device 'Nexus 6P' in screenshots.yaml.

screenshots.yaml

# A list of screen capture tests
tests:
    - test_driver/instrumented_app.dart 
staging: /tmp/screenshots
locales:
    - en-US
    - de-DE
# A map of devices to emulate
devices:
    android:
        Nexus 6P:
# Frame screenshots
frame: true

Ouput of screenshots

Can't load Kernel binary: Invalid kernel binary format version.
Precompiling executable...
Precompiled screenshots:main.
[  +30 ms] Starting flutter daemon...
[   +7 ms] executing: flutter daemon
[ +527 ms] <== [{"event":"daemon.connected","params":{"version":"0.5.3","pid":5312}}]
[   +3 ms] ==> [{"method":"device.enable","id":0}]
[        ] waiting for response: {method: device.enable, id: 0}
[        ] <== [{"event":"daemon.logMessage","params":{"level":"status","message":"Starting device daemon..."}}]
[        ] Warning: ignoring log message: [{"event":"daemon.logMessage","params":{"level":"status","message":"Starting device daemon..."}}]
[  +10 ms] <== [{"id":0,"result":[null,null,null,null]}]
[ +113 ms] Starting flutter daemon... (completed in 0.6s)
[        ] ==> [{"method":"device.getDevices","id":1}]
[        ] waiting for response: {method: device.getDevices, id: 1}
[   +2 ms] <== [{"id":1,"result":[]}]
[        ] ==> [{"method":"emulator.getEmulators","id":2}]
[        ] waiting for response: {method: emulator.getEmulators, id: 2}
[  +35 ms] <== [{"id":2,"result":[{"id":"Android_Emulator_API_28","name":"Android Emulator API 28","category":"mobile","platformType":"android"}]}]
[        ] daemonEmulator=id: Android_Emulator_API_28, name: Android Emulator API 28, category: mobile, platformType: android
[   +5 ms] No device attached or emulator installed for device 'Nexus 6P' in screenshots.yaml.
[   +1 ms] 
           Guide:
[        ] 
             Attached devices:
[        ] 
             Installed emulators:
[        ]     Android_Emulator_API_28
[        ] 
             Supported screens:
[        ]     android:
[        ]       Nexus 5X
[        ]       Nexus 6P
[        ]       Nexus 9
[        ]     ios:
[        ]       iPhone 6 Plus
[        ]       iPhone 6S Plus
[        ]       iPhone 6s Plus
[        ]       iPhone 7 Plus
[        ]       iPhone 8 Plus
[        ]       iPhone X
[        ]       iPhone XS
[        ]       iPhone XS Max
[        ]       iPhone Xs
[        ]       iPhone Xs Max
[        ]       iPad Pro (12.9-inch) (1st generation)
[        ]       iPad Pro (12.9-inch) (2nd generation)
[        ]       iPad Pro (12.9-inch) (3rd generation)
[        ] 
             Each device listed in screenshots.yaml with framing required must
               1. have a supported screen
               2. have an attached device or an installed emulator/simulator.
             To bypass requirement #1 add 'frame: false' after device in screenshots.yaml

Case 2:

  • screenshots.yaml: Android_Emulator_API_28
  • Output of screenshots: Screen not available for device 'Android_Emulator_API_28' in screenshots.yaml.

screenshots.yaml

# A list of screen capture tests
tests:
    - test_driver/instrumented_app.dart 
staging: /tmp/screenshots
locales:
    - en-US
    - de-DE
# A map of devices to emulate
devices:
    android:
        Android_Emulator_API_28:
# Frame screenshots
frame: true

Ouput of screenshots

Can't load Kernel binary: Invalid kernel binary format version.
Precompiling executable...
Precompiled screenshots:main.
[  +32 ms] Starting flutter daemon...
[   +7 ms] executing: flutter daemon
[ +521 ms] <== [{"event":"daemon.connected","params":{"version":"0.5.3","pid":5297}}]
[   +3 ms] ==> [{"method":"device.enable","id":0}]
[        ] waiting for response: {method: device.enable, id: 0}
[        ] <== [{"event":"daemon.logMessage","params":{"level":"status","message":"Starting device daemon..."}}]
[        ] Warning: ignoring log message: [{"event":"daemon.logMessage","params":{"level":"status","message":"Starting device daemon..."}}]
[  +10 ms] <== [{"id":0,"result":[null,null,null,null]}]
[ +139 ms] Starting flutter daemon... (completed in 0.6s)
[   +1 ms] ==> [{"method":"device.getDevices","id":1}]
[        ] waiting for response: {method: device.getDevices, id: 1}
[   +4 ms] <== [{"id":1,"result":[]}]
[   +1 ms] ==> [{"method":"emulator.getEmulators","id":2}]
[        ] waiting for response: {method: emulator.getEmulators, id: 2}
[  +59 ms] <== [{"id":2,"result":[{"id":"Android_Emulator_API_28","name":"Android Emulator API 28","category":"mobile","platformType":"android"}]}]
[        ] daemonEmulator=id: Android_Emulator_API_28, name: Android Emulator API 28, category: mobile, platformType: android
[   +5 ms] Screen not available for device 'Android_Emulator_API_28' in screenshots.yaml.
[   +1 ms] 
             Use a device with a supported screen or set 'frame: false' for
             device in screenshots.yaml.
[   +1 ms] 
             Supported screens:
[        ]     android:
[        ]       Nexus 5X
[        ]       Nexus 6P
[        ]       Nexus 9
[        ]     ios:
[        ]       iPhone 6 Plus
[        ]       iPhone 6S Plus
[        ]       iPhone 6s Plus
[        ]       iPhone 7 Plus
[        ]       iPhone 8 Plus
[        ]       iPhone X
[        ]       iPhone XS
[        ]       iPhone XS Max
[        ]       iPhone Xs
[        ]       iPhone Xs Max
[        ]       iPad Pro (12.9-inch) (1st generation)
[        ]       iPad Pro (12.9-inch) (2nd generation)
[        ]       iPad Pro (12.9-inch) (3rd generation)
[        ] 
             If framing for device is required, request screen support by
             creating an issue in:
             https://github.com/mmcc007/screenshots/issues.
@abdallaadelessa
Copy link

abdallaadelessa commented Mar 18, 2021

i was able to make it work using the following command

Create Command

avdmanager --verbose create avd -n Nexus_5X -k "system-images;android-29;default;x86" -d "Nexus 5X"

Launch Command

emulator -avd Nexus_5X -delay-adb -verbose -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim

My Config

# A list of screen capture tests
tests:
  # Note: flutter driver expects a pair of files eg, main1.dart and main1_test.dart
  - test_driver/main1.dart

# Interim location of screenshots from tests
staging: /tmp/screenshots

# A list of locales supported by the app
locales:
  - en-US

# A map of devices to emulate
devices:
  android:
    Nexus 5X:
      frame: true

the problem is with the avd name
Nexus_5X seems to work fine
i tried also Nexus_9 and also working
so i think the screenshots lib expects the avd name to be the device name separated by an underscore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants