Sdk path should be used when launching emulator
Summary: Changelog: Fixed issue where a missing ANDROID_SDK_ROOT env var made it impossible to launch emulators Run into an issue where ANDROID_SDK_ROOT wasn't set for my user, causing Flipper not to be able to launch emulator, which was looked up from the path rather than using the flipper settings. Fixes: https://github.com/facebook/flipper/issues/3119 Reviewed By: timur-valiev Differential Revision: D33158280 fbshipit-source-id: ea5616b10265ed43f1012c58da081be275ff1d5b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
730d47932d
commit
ef2a86e7a8
@@ -23,9 +23,6 @@ import {
|
||||
} from '../../FlipperServerConfig';
|
||||
|
||||
export class AndroidDeviceManager {
|
||||
// cache emulator path
|
||||
private emulatorPath: string | undefined;
|
||||
|
||||
constructor(public flipperServer: FlipperServerImpl) {}
|
||||
|
||||
private createDevice(
|
||||
@@ -119,25 +116,16 @@ export class AndroidDeviceManager {
|
||||
});
|
||||
}
|
||||
|
||||
async getEmulatorPath(): Promise<string> {
|
||||
if (this.emulatorPath) {
|
||||
return this.emulatorPath;
|
||||
}
|
||||
// TODO: this doesn't respect the currently configured android_home in settings!
|
||||
try {
|
||||
this.emulatorPath = (await promisify(which)('emulator')) as string;
|
||||
} catch (_e) {
|
||||
this.emulatorPath = join(
|
||||
process.env.ANDROID_HOME || process.env.ANDROID_SDK_ROOT || '',
|
||||
'emulator',
|
||||
'emulator',
|
||||
);
|
||||
}
|
||||
return this.emulatorPath;
|
||||
getEmulatorPath(): string {
|
||||
return join(
|
||||
this.flipperServer.config.settings.androidHome,
|
||||
'emulator',
|
||||
'emulator',
|
||||
);
|
||||
}
|
||||
|
||||
async getAndroidEmulators(): Promise<string[]> {
|
||||
const emulatorPath = await this.getEmulatorPath();
|
||||
const emulatorPath = this.getEmulatorPath();
|
||||
return new Promise<string[]>((resolve) => {
|
||||
child_process.execFile(
|
||||
emulatorPath as string,
|
||||
|
||||
Reference in New Issue
Block a user