mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-08-31 17:49:33 +00:00
Switch to sh.
This commit is contained in:
@@ -31,12 +31,12 @@ function launchEmulator(apiLevel, target, arch, profile, headless, disableAnimat
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(`Creating AVD without custom profile.`);
|
console.log(`Creating AVD without custom profile.`);
|
||||||
yield exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`);
|
yield exec.exec(`sh -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`);
|
||||||
}
|
}
|
||||||
// start emulator
|
// start emulator
|
||||||
console.log('Starting emulator.');
|
console.log('Starting emulator.');
|
||||||
const noWindow = headless ? '-no-window' : '';
|
const noWindow = headless ? '-no-window' : '';
|
||||||
yield exec.exec(`bash -c \\"${process.env.ANDROID_HOME}/emulator/emulator -avd test ${noWindow} -no-snapshot -noaudio -no-boot-anim &"`);
|
yield exec.exec(`sh -c \\"${process.env.ANDROID_HOME}/emulator/emulator -avd test ${noWindow} -no-snapshot -noaudio -no-boot-anim &"`);
|
||||||
// wait for emulator to complete booting
|
// wait for emulator to complete booting
|
||||||
yield waitForDevice();
|
yield waitForDevice();
|
||||||
yield exec.exec(`${ADB_PATH} shell input keyevent 82`);
|
yield exec.exec(`${ADB_PATH} shell input keyevent 82`);
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ function installAndroidSdk(apiLevel, target, arch) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
||||||
console.log('Installing latest build tools, platform tools, platform, and emulator.');
|
console.log('Installing latest build tools, platform tools, platform, and emulator.');
|
||||||
yield exec.exec(`bash -c \\"${sdkmangerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' emulator > /dev/null"`);
|
yield exec.exec(`sh -c \\"${sdkmangerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' emulator > /dev/null"`);
|
||||||
console.log('Installing system images.');
|
console.log('Installing system images.');
|
||||||
yield exec.exec(`bash -c \\"${sdkmangerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"${sdkmangerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.installAndroidSdk = installAndroidSdk;
|
exports.installAndroidSdk = installAndroidSdk;
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ export async function launchEmulator(apiLevel: number, target: string, arch: str
|
|||||||
await exec.exec(`${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`);
|
await exec.exec(`${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`Creating AVD without custom profile.`);
|
console.log(`Creating AVD without custom profile.`);
|
||||||
await exec.exec(`bash -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`);
|
await exec.exec(`sh -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start emulator
|
// start emulator
|
||||||
console.log('Starting emulator.');
|
console.log('Starting emulator.');
|
||||||
const noWindow = headless ? '-no-window' : '';
|
const noWindow = headless ? '-no-window' : '';
|
||||||
await exec.exec(`bash -c \\"${process.env.ANDROID_HOME}/emulator/emulator -avd test ${noWindow} -no-snapshot -noaudio -no-boot-anim &"`);
|
await exec.exec(`sh -c \\"${process.env.ANDROID_HOME}/emulator/emulator -avd test ${noWindow} -no-snapshot -noaudio -no-boot-anim &"`);
|
||||||
|
|
||||||
// wait for emulator to complete booting
|
// wait for emulator to complete booting
|
||||||
await waitForDevice();
|
await waitForDevice();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const BUILD_TOOLS_VERSION = '29.0.2';
|
|||||||
export async function installAndroidSdk(apiLevel: number, target: string, arch: string): Promise<void> {
|
export async function installAndroidSdk(apiLevel: number, target: string, arch: string): Promise<void> {
|
||||||
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
const sdkmangerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`;
|
||||||
console.log('Installing latest build tools, platform tools, platform, and emulator.');
|
console.log('Installing latest build tools, platform tools, platform, and emulator.');
|
||||||
await exec.exec(`bash -c \\"${sdkmangerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' emulator > /dev/null"`);
|
await exec.exec(`sh -c \\"${sdkmangerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' emulator > /dev/null"`);
|
||||||
console.log('Installing system images.');
|
console.log('Installing system images.');
|
||||||
await exec.exec(`bash -c \\"${sdkmangerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
await exec.exec(`sh -c \\"${sdkmangerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user