@@ -150,9 +150,9 @@ function tryInstallAppOnDevice(args, device) {
150150 }
151151}
152152
153- function tryLaunchAppOnDevice ( device , packageName , adbPath ) {
153+ function tryLaunchAppOnDevice ( device , packageName , adbPath , mainActivity ) {
154154 try {
155- const adbArgs = [ '-s' , device , 'shell' , 'am' , 'start' , '-n' , packageName + '/.MainActivity' ] ;
155+ const adbArgs = [ '-s' , device , 'shell' , 'am' , 'start' , '-n' , packageName + '/.' + mainActivity ] ;
156156 console . log ( chalk . bold (
157157 `Starting the app on ${ device } (${ adbPath } ${ adbArgs . join ( ' ' ) } )...`
158158 ) ) ;
@@ -167,7 +167,7 @@ function tryLaunchAppOnDevice(device, packageName, adbPath) {
167167function installAndLaunchOnDevice ( args , selectedDevice , packageName , adbPath ) {
168168 tryRunAdbReverse ( selectedDevice ) ;
169169 tryInstallAppOnDevice ( args , selectedDevice ) ;
170- tryLaunchAppOnDevice ( selectedDevice , packageName , adbPath ) ;
170+ tryLaunchAppOnDevice ( selectedDevice , packageName , adbPath , args . mainActivity ) ;
171171}
172172
173173function runOnAllDevices ( args , cmd , packageName , adbPath ) {
@@ -215,7 +215,7 @@ function runOnAllDevices(args, cmd, packageName, adbPath){
215215 if ( devices && devices . length > 0 ) {
216216 devices . forEach ( ( device ) => {
217217 tryRunAdbReverse ( device ) ;
218- tryLaunchAppOnDevice ( device , packageName , adbPath ) ;
218+ tryLaunchAppOnDevice ( device , packageName , adbPath , args . mainActivity ) ;
219219 } ) ;
220220 } else {
221221 try {
@@ -286,6 +286,10 @@ module.exports = {
286286 description : '--flavor has been deprecated. Use --variant instead' ,
287287 } , {
288288 command : '--variant [string]' ,
289+ } , {
290+ command : '--main-activity [string]' ,
291+ description : 'Name of the activity to start' ,
292+ default : 'MainActivity' ,
289293 } , {
290294 command : '--deviceId [string]' ,
291295 description : 'builds your app and starts it on a specific device/simulator with the ' +
0 commit comments