Detox: Wont Launch Valid Android Emulator AVD
Description
The detox test
command fails with the error message "Error: Emulator with name <emulator name> has a corrupt config.ini file (/path/to/config.ini), try fixing it by recreating an emulator.
This happens for a perfectly valid emulator avd that starts up without problem. In my particular case the avd was created from the command line using the avdmanager.bat create avd
command.
Looking through the source code, this error is thrown from EmulatorDriver.js _fixEmulatorConfigIniSkinName(..)
when the config.ini file for the emulator does not have a ‘skin.name’ value and does not have hw.lc.width
and hw.lcd.height
values.
It is unclear why the emulator driver is trying to fix the config.ini in this way. Ideally the command should work for such an emulator avd since the avdmanager does not create it with those values and the avd works without them.
If there is a specific scenario where this behavior is required or it is a requirement specific to detox then, at a minimum, the error message should be made more descriptive to provide a clear solution. Such as instructing the user that skin and/or height + width specification is required in the config.ini.
Steps to Reproduce
Run the detox test -c <config>
command. Use a configuration of type android.emulator
and select an avd name with a config.ini
file that has neither the skin.name
property nor the hw.lcd.width
/ hw.lcd.height
properties.
Detox, Node, Device, Xcode and macOS Versions
- Detox:
10.0.7
- React Native:
0.57.8
- Node:
11.6.0
- Device:
Android Emulator
- Xcode: N/A
- macOS: N/A
- Windows:
Windows 10 Pro v1703
Device and verbose Detox logs
detox[716] INFO: [DetoxServer.js] server listening on localhost:50369...
detox[716] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:50369
detox[716] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"3a17d4e8-c480-0900-5910-4068d33e6274","role":"tester"},"messageId":0}
detox[716] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=3a17d4e8-c480-0900-5910-4068d33e6274
detox[716] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=3a17d4e8-c480-0900-5910-4068d33e6274
detox[716] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"3a17d4e8-c480-0900-5910-4068d33e6274","role":"tester"},"messageId":0}
detox[716] DEBUG: [exec.js/EXEC_CMD, #0] C:\path\to\emulator -list-avds --verbose
detox[716] TRACE: [exec.js/EXEC_SUCCESS, #0] <avd name>
detox[716] ERROR: [index.js/DETOX_INIT_ERROR] Error: Emulator with name <emulator name> has a corrupt config.ini file (C:\path\to/<avd name>.avd/config.ini), try fixing it by recreating an emulator.
at EmulatorDriver._fixEmulatorConfigIniSkinName (C:\path\to\EmulatorDriver.js:30:15)
at EmulatorDriver.acquireFreeDevice (C:\path\to\EmulatorDriver.js:91:16)
at process.internalTickCallback (internal/process/next_tick.js:77:7)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 17 (7 by maintainers)
Commits related to this issue
- #42 Fix crash when starting android emulator in detox This refers to https://github.com/wix/Detox/issues/1157 — committed to mapswipe/mapswipe by laurentS 5 years ago
I added
to my travis config and I think it did the trick
appending this got rid of that error:
now off to other android e2e issues…
lots of idling:
Short answer is Not yet,
I tried many ways to install emulator with appropriate hardware configurations and I didn’t succeed yet.
If I try in my Mac machine I can see .android/XXXX.avd/config.ini with all necessary parameters but on linux machine I didn’t find it.
@ravi-ts As a workaround you can manually browser to where your emulator config.ini is and put in explicit values for
hw.lc.width
andhw.lcd.height
. This should solve the emulator startup problem.