Skip to content

Commit a46a903

Browse files
authored
fix: run-android device not found on change from deviceId to device (#2595)
1 parent d0feca0 commit a46a903

File tree

1 file changed

+8
-8
lines changed
  • packages/cli-platform-android/src/commands/runAndroid

1 file changed

+8
-8
lines changed

packages/cli-platform-android/src/commands/runAndroid/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ async function buildAndRun(args: Flags, androidProject: AndroidProject) {
178178

179179
if (device.connected) {
180180
return runOnSpecificDevice(
181-
{...args, deviceId: device.deviceId},
181+
{...args, device: device.deviceId},
182182
adbPath,
183183
androidProject,
184184
selectedTask,
@@ -192,7 +192,7 @@ async function buildAndRun(args: Flags, androidProject: AndroidProject) {
192192
if (result.success) {
193193
logger.info('Successfully launched emulator.');
194194
return runOnSpecificDevice(
195-
{...args, deviceId: emulator},
195+
{...args, device: emulator},
196196
adbPath,
197197
androidProject,
198198
selectedTask,
@@ -217,7 +217,7 @@ function runOnSpecificDevice(
217217
selectedTask?: string,
218218
) {
219219
const devices = adb.getDevices(adbPath);
220-
const {deviceId} = args;
220+
const {device} = args;
221221

222222
// if coming from run-android command and we have selected task
223223
// from interactive mode we need to create appropriate build task
@@ -226,8 +226,8 @@ function runOnSpecificDevice(
226226
? [selectedTask.replace('install', 'assemble')]
227227
: [];
228228

229-
if (devices.length > 0 && deviceId) {
230-
if (devices.indexOf(deviceId) !== -1) {
229+
if (devices.length > 0 && device) {
230+
if (devices.indexOf(device) !== -1) {
231231
let gradleArgs = getTaskNames(
232232
androidProject.appName,
233233
args.mode,
@@ -246,7 +246,7 @@ function runOnSpecificDevice(
246246
}
247247

248248
if (args.activeArchOnly) {
249-
const architecture = adb.getCPU(adbPath, deviceId);
249+
const architecture = adb.getCPU(adbPath, device);
250250

251251
if (architecture !== null) {
252252
logger.info(`Detected architecture ${architecture}`);
@@ -263,14 +263,14 @@ function runOnSpecificDevice(
263263

264264
installAndLaunchOnDevice(
265265
args,
266-
deviceId,
266+
device,
267267
adbPath,
268268
androidProject,
269269
selectedTask,
270270
);
271271
} else {
272272
logger.error(
273-
`Could not find device with the id: "${deviceId}". Please choose one of the following:`,
273+
`Could not find device: "${device}". Please choose one of the following:`,
274274
...devices,
275275
);
276276
}

0 commit comments

Comments
 (0)