Skip to content

Commit 5d9d91b

Browse files
committed
fix: case for missing appName in getInstallOutputFileName
1 parent 665bd9b commit 5d9d91b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/platform-android/src/lib/commands/runAndroid/findOutputFile.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { existsSync } from 'node:fs';
1+
import { existsSync, readdirSync } from 'node:fs';
22
import { logger, spawn } from '@rock-js/tools';
33
import { getAdbPath } from './adb.js';
44
import type { AndroidProject } from './runAndroid.js';
@@ -64,6 +64,16 @@ async function getInstallOutputFileName(
6464
return outputFile;
6565
}
6666

67+
// check if there is a file like -debug.apk (missing app name)
68+
if (existsSync(buildDirectory)) {
69+
const pattern = `-${variant}.${apkOrAab}`;
70+
const files = readdirSync(buildDirectory);
71+
const matchingFile = files?.find((file) => file.endsWith(pattern));
72+
if (matchingFile) {
73+
return matchingFile;
74+
}
75+
}
76+
6777
logger.debug('Could not find the output file:', {
6878
buildDirectory,
6979
outputFile,

0 commit comments

Comments
 (0)