Skip to content

Commit bfee9a8

Browse files
committed
chore: add debug logs for Android startup
1 parent 64e7277 commit bfee9a8

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

packages/platform-android/src/instance.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
HarnessPlatformRunner,
66
} from '@react-native-harness/platforms';
77
import type { Config as HarnessConfig } from '@react-native-harness/config';
8+
import { logger } from '@react-native-harness/tools';
89
import {
910
AndroidPlatformConfig,
1011
assertAndroidDeviceEmulator,
@@ -21,6 +22,8 @@ import { createAndroidAppMonitor } from './app-monitor.js';
2122
import { HarnessAppPathError, HarnessEmulatorConfigError } from './errors.js';
2223
import fs from 'node:fs';
2324

25+
const androidInstanceLogger = logger.child('android-instance');
26+
2427
const getHarnessAppPath = (): string => {
2528
const appPath = process.env.HARNESS_APP_PATH;
2629

@@ -61,6 +64,12 @@ export const getAndroidEmulatorPlatformInstance = async (
6164
let adbId = await getAdbId(config.device);
6265
let startedByHarness = false;
6366

67+
androidInstanceLogger.debug(
68+
'resolved Android emulator %s with adb id %s',
69+
config.device.name,
70+
adbId ?? 'not-found'
71+
);
72+
6473
if (!adbId) {
6574
const avdConfig = config.device.avd;
6675

@@ -69,6 +78,10 @@ export const getAndroidEmulatorPlatformInstance = async (
6978
}
7079

7180
if (!(await adb.hasAvd(config.device.name))) {
81+
androidInstanceLogger.debug(
82+
'creating Android AVD %s before startup',
83+
config.device.name
84+
);
7285
await adb.createAvd({
7386
name: config.device.name,
7487
apiLevel: avdConfig.apiLevel,
@@ -78,15 +91,29 @@ export const getAndroidEmulatorPlatformInstance = async (
7891
});
7992
}
8093

94+
androidInstanceLogger.debug(
95+
'starting Android emulator %s',
96+
config.device.name
97+
);
8198
await adb.startEmulator(config.device.name);
8299
adbId = await adb.waitForEmulator(config.device.name);
83100
startedByHarness = true;
101+
102+
androidInstanceLogger.debug(
103+
'Android emulator %s connected as %s',
104+
config.device.name,
105+
adbId
106+
);
84107
}
85108

86109
if (!adbId) {
87110
throw new DeviceNotFoundError(getDeviceName(config.device));
88111
}
89112

113+
androidInstanceLogger.debug(
114+
'waiting for Android emulator %s to finish booting',
115+
adbId
116+
);
90117
await adb.waitForBoot(adbId);
91118

92119
const isInstalled = await adb.isAppInstalled(adbId, config.bundleId);

0 commit comments

Comments
 (0)