From d1bab9e4a471b47adf87695c4365800c6485085e Mon Sep 17 00:00:00 2001 From: Ely Alvarado Date: Sun, 29 Apr 2018 18:50:28 -0500 Subject: [PATCH 1/2] Update Android Emulator Path Since Android SDK Tools 25.3.0 (March 2017) The Android Emulator was removed from the SDK Tools package and moved to a different SDK directory. For recent API versions (and depending on the OS architecture) running the old tools/emulator can cause errors because the different architecture versions of the emulator won't be found in the tools folder of the Android SDK. Given that from August this year the minimum target version required for submitting apps to the Play store will be API 26, the path of the emulator should be updated. --- detox/src/devices/android/Emulator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detox/src/devices/android/Emulator.js b/detox/src/devices/android/Emulator.js index 7e56b1e109..b66612c822 100644 --- a/detox/src/devices/android/Emulator.js +++ b/detox/src/devices/android/Emulator.js @@ -10,7 +10,7 @@ const argparse = require('../../utils/argparse'); class Emulator { constructor() { - this.emulatorBin = path.join(Environment.getAndroidSDKPath(), 'tools', 'emulator'); + this.emulatorBin = path.join(Environment.getAndroidSDKPath(), 'emulator', 'emulator'); } async listAvds() { From 4b4cd41b01c486eac50cad7f08e5b70d25fefd8c Mon Sep 17 00:00:00 2001 From: Ely Alvarado Date: Sun, 29 Apr 2018 22:03:45 -0500 Subject: [PATCH 2/2] Check if new Emulator Path exists before setting it Updated the constructor to use the new Emulator path if it exists, or else continue using the old emulator path. This allows backward compatibility with users of older Android SDK versions. --- detox/src/devices/android/Emulator.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/detox/src/devices/android/Emulator.js b/detox/src/devices/android/Emulator.js index b66612c822..35b5904e2e 100644 --- a/detox/src/devices/android/Emulator.js +++ b/detox/src/devices/android/Emulator.js @@ -10,7 +10,9 @@ const argparse = require('../../utils/argparse'); class Emulator { constructor() { - this.emulatorBin = path.join(Environment.getAndroidSDKPath(), 'emulator', 'emulator'); + const newEmulatorPath = path.join(Environment.getAndroidSDKPath(), 'emulator', 'emulator'); + const oldEmulatorPath = path.join(Environment.getAndroidSDKPath(), 'tools', 'emulator'); + this.emulatorBin = fs.existsSync(newEmulatorPath) ? newEmulatorPath : oldEmulatorPath; } async listAvds() {