Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions local-cli/runAndroid/runAndroid.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,10 +56,10 @@ function getAdbPath() {
}

// Runs ADB reverse tcp:8081 tcp:8081 to allow loading the jsbundle from the packager
function tryRunAdbReverse(device) {
function tryRunAdbReverse(packagerPort, device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:8081'];
const adbArgs = ['reverse', `tcp:${packagerPort}`, `tcp:${packagerPort}`];

// If a device is specified then tell adb to use it
if (device) {
Expand DownExpand Up@@ -167,7 +167,7 @@ function tryLaunchAppOnDevice(device, packageNameWithSuffix, packageName, adbPat
}

function installAndLaunchOnDevice(args, selectedDevice, packageNameWithSuffix, packageName, adbPath) {
tryRunAdbReverse(selectedDevice);
tryRunAdbReverse(args.port, selectedDevice);
tryInstallAppOnDevice(args, selectedDevice);
tryLaunchAppOnDevice(selectedDevice, packageNameWithSuffix, packageName, adbPath, args.mainActivity);
}
Expand DownExpand Up@@ -216,7 +216,7 @@ function runOnAllDevices(args, cmd, packageNameWithSuffix, packageName, adbPath)
const devices = adb.getDevices();
if (devices && devices.length > 0) {
devices.forEach((device) => {
tryRunAdbReverse(device);
tryRunAdbReverse(args.port, device);
tryLaunchAppOnDevice(device, packageNameWithSuffix, packageName, adbPath, args.mainActivity);
});
} else {
Expand DownExpand Up@@ -307,5 +307,9 @@ module.exports = {
}, {
command: '--no-packager',
description: 'Do not launch packager while building',
}, {
command: '--port [number]',
default: 8081,
parse: (val: string) => Number(val),
}],
};