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 number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ function tryInstallAppOnDevice(args, device) {
}
}

function tryLaunchAppOnDevice(device, packageName, adbPath) {
function tryLaunchAppOnDevice(device, packageName, adbPath, mainActivity) {
try {
const adbArgs = ['-s', device, 'shell', 'am', 'start', '-n', packageName + '/.MainActivity'];
const adbArgs = ['-s', device, 'shell', 'am', 'start', '-n', packageName + '/.' + mainActivity];
console.log(chalk.bold(
`Starting the app on ${device} (${adbPath} ${adbArgs.join(' ')})...`
));
Expand All @@ -163,7 +163,7 @@ function tryLaunchAppOnDevice(device, packageName, adbPath) {
function installAndLaunchOnDevice(args, selectedDevice, packageName, adbPath) {
tryRunAdbReverse(selectedDevice);
tryInstallAppOnDevice(args, selectedDevice);
tryLaunchAppOnDevice(selectedDevice, packageName, adbPath);
tryLaunchAppOnDevice(selectedDevice, packageName, adbPath, args.mainActivity);
}

function runOnAllDevices(args, cmd, packageName, adbPath){
Expand Down Expand Up @@ -211,7 +211,7 @@ function runOnAllDevices(args, cmd, packageName, adbPath){
if (devices && devices.length > 0) {
devices.forEach((device) => {
tryRunAdbReverse(device);
tryLaunchAppOnDevice(device, packageName, adbPath);
tryLaunchAppOnDevice(device, packageName, adbPath, args.mainActivity);
});
} else {
try {
Expand Down Expand Up @@ -282,6 +282,10 @@ module.exports = {
description: '--flavor has been deprecated. Use --variant instead',
}, {
command: '--variant [string]',
}, {
command: '--main-activity [string]',
description: 'Name of the activity to start',
default: 'MainActivity',
}, {
command: '--deviceId [string]',
description: 'builds your app and starts it on a specific device/simulator with the ' +
Expand Down