From f3cc70fdb812d47b99e31b39ee12a3733a30c969 Mon Sep 17 00:00:00 2001 From: HBLADEH <1012582116@qq.com> Date: Tue, 6 May 2025 15:36:32 +0800 Subject: [PATCH] feat(android): fix custom adb path no effect --- packages/android/src/page/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/android/src/page/index.ts b/packages/android/src/page/index.ts index e3c4d1d7..0e779b22 100644 --- a/packages/android/src/page/index.ts +++ b/packages/android/src/page/index.ts @@ -52,13 +52,15 @@ export class AndroidDevice implements AndroidDevicePage { try { const androidAdbPath = getAIConfig(MIDSCENE_ADB_PATH); - this.adb = await ADB.createADB({ + // If `androidAdbPath` exists, use `newADB()` + this.adb = androidAdbPath ? this.adb = await new ADB({ udid: this.deviceId, adbExecTimeout: 60000, - executable: androidAdbPath - ? { path: androidAdbPath, defaultArgs: [] } - : undefined, - }); + executable: { path: androidAdbPath, defaultArgs: [] } + }) : await ADB.createADB({ + udid: this.deviceId, + adbExecTimeout: 60000, + }) const size = await this.getScreenSize(); console.log(`