Fix emulator launching bug

Summary:
I was getting the following error when trying to launch an emulator:
`PANIC: Missing emulator engine program for 'x86' CPU.`

It seems like emulator/emulator is more reliable than tools/emulator: https://stackoverflow.com/questions/26483370/android-emulator-error-message-panic-missing-emulator-engine-program-for-x86

So put them both on the path in that order.

Reviewed By: passy

Differential Revision: D13040325

fbshipit-source-id: 11e8b24b2a99e02955128d5fb7c17764b98388fa
This commit is contained in:
John Knox
2018-11-13 11:15:34 -08:00
committed by Facebook Github Bot
parent 57235131fc
commit d9a9439dfa
3 changed files with 13 additions and 9 deletions

View File

@@ -21,14 +21,12 @@ type Props = {
class DevicesButton extends Component<Props> {
launchEmulator = (name: string) => {
const child = spawn(
`${process.env.ANDROID_HOME || ''}/tools/emulator`,
[`@${name}`],
{
detached: true,
stdio: 'ignore',
},
);
const child = spawn('emulator', [`@${name}`], {
detached: true,
});
child.stderr.on('data', data => {
console.error(`Android emulator error: ${data}`);
});
child.on('error', console.error);
this.props.preferDevice(name);
};