diff --git a/spec/afterStart.test.ts b/spec/afterStart.test.ts index 0a8910d..c21a807 100644 --- a/spec/afterStart.test.ts +++ b/spec/afterStart.test.ts @@ -11,8 +11,11 @@ describe("after start a emulator", () => { if (avds.length === 0) { avdName = `TestCreate_${Math.random()}`; const images = (await android.listImages()).filter((item) => item.vendor === "default"); + console.log("images"); + console.log(images); if (images.length === 0) return; - await android.createAVD({ name: avdName, package: images[images.length - 1].name, force: false }); + const image = images[images.length - 1].name; + await android.createAVD({ name: avdName, package: image, force: false }); } else { avdName = avds[0].Name; } diff --git a/src/index.ts b/src/index.ts index b9a72ae..e0b7b6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -226,6 +226,9 @@ class Android { * @param name name of AVD */ async createAVD(options: CreateAVDOptions) { + if (options.package) { + await this.sdkmanager(options.package); + } const cmdParams = Object.keys(options).reduce((prev, curr) => { const val = options[curr as keyof CreateAVDOptions]; if (typeof val === "boolean") {