Skip to content

Commit 70e3f6e

Browse files
committed
Merge branch 'main' into release/v2
* main: Prepare for release 2.14.1. Fix AVD creation hang when profile is not specified.
2 parents 02cf805 + 0d8602f commit 70e3f6e

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## v2.14.1
4+
5+
* Fix hang during AVD creation when `profile` is not specified - [#113](https://github.com/ReactiveCircus/android-emulator-runner/issues/113).
6+
37
## v2.14.0
48

59
* Support specifying SD card path or size via `sdcard-path-or-size`.

lib/emulator-manager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const EMULATOR_BOOT_TIMEOUT_SECONDS = 600;
3737
function launchEmulator(apiLevel, target, arch, profile, sdcardPathOrSize, avdName, emulatorOptions, disableAnimations) {
3838
return __awaiter(this, void 0, void 0, function* () {
3939
// create a new AVD
40-
const profileOption = profile.trim() !== '' ? `--device "${profile}"` : '';
41-
const sdcardPathOrSizeOption = sdcardPathOrSize.trim() !== '' ? `--sdcard "${sdcardPathOrSize}"` : '';
40+
const profileOption = profile.trim() !== '' ? `--device '${profile}'` : '';
41+
const sdcardPathOrSizeOption = sdcardPathOrSize.trim() !== '' ? `--sdcard '${sdcardPathOrSize}'` : '';
4242
console.log(`Creating AVD.`);
43-
yield exec.exec(`avdmanager create avd --force -n "${avdName}" --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" ${profileOption} ${sdcardPathOrSizeOption}`);
43+
yield exec.exec(`sh -c \\"echo no | avdmanager create avd --force -n "${avdName}" --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}' ${profileOption} ${sdcardPathOrSizeOption}"`);
4444
// start emulator
4545
console.log('Starting emulator.');
4646
// turn off hardware acceleration on Linux

src/emulator-manager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ export async function launchEmulator(
1616
disableAnimations: boolean
1717
): Promise<void> {
1818
// create a new AVD
19-
const profileOption = profile.trim() !== '' ? `--device "${profile}"` : '';
20-
const sdcardPathOrSizeOption = sdcardPathOrSize.trim() !== '' ? `--sdcard "${sdcardPathOrSize}"` : '';
19+
const profileOption = profile.trim() !== '' ? `--device '${profile}'` : '';
20+
const sdcardPathOrSizeOption = sdcardPathOrSize.trim() !== '' ? `--sdcard '${sdcardPathOrSize}'` : '';
2121
console.log(`Creating AVD.`);
22-
await exec.exec(`avdmanager create avd --force -n "${avdName}" --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" ${profileOption} ${sdcardPathOrSizeOption}`);
22+
await exec.exec(
23+
`sh -c \\"echo no | avdmanager create avd --force -n "${avdName}" --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}' ${profileOption} ${sdcardPathOrSizeOption}"`
24+
);
2325

2426
// start emulator
2527
console.log('Starting emulator.');

0 commit comments

Comments
 (0)