@@ -374,7 +374,7 @@ class AndroidHelper
374374
375375 public static function run (activityName : String , deviceID : String = null ): Void
376376 {
377- var args = [" shell" , " am" , " start " , " -a " , " android.intent.action.MAIN " , " -n " , activityName ];
377+ var args = [" shell" , " am" ];
378378
379379 if (deviceID != null && deviceID != " " )
380380 {
@@ -384,7 +384,9 @@ class AndroidHelper
384384 connect (deviceID );
385385 }
386386
387- System .runCommand (adbPath , adbName , args );
387+ System .runCommand (adbPath , adbName , args .concat ([" force-stop" , activityName ]));
388+
389+ System .runCommand (adbPath , adbName , args .concat ([" start" , " -a" , " android.intent.action.MAIN" , " -c" , " android.intent.category.LAUNCHER" , " -n" , activityName ]));
388390 }
389391
390392 public static function trace (project : HXProject , debug : Bool , deviceID : String = null , customFilter : String = null ): Void
@@ -406,16 +408,19 @@ class AndroidHelper
406408 connect (deviceID );
407409 }
408410
409- var pid = System .runProcess (adbPath , adbName , args .concat ([" shell" , " pidof" , project .meta .packageName ]));
411+ var pidString = StringTools . trim ( System .runProcess (adbPath , adbName , args .concat ([" shell" , " pidof" , " -s " , project .meta .packageName ]) ));
410412
411413 args .push (" logcat" );
412414
413415 System .runCommand (adbPath , adbName , args .concat ([" -c" ]));
414416
415- pid = StringTools .trim (pid .split (" " )[0 ]);
417+ var pidInt = Std .parseInt (pidString );
418+
419+ if (pidInt != null )
420+ args .push (' --pid=' + pidInt );
416421
417- if ( pid . length > 0 )
418- args .push (' --pid= ' + pid );
422+ args . push ( " -v " );
423+ args .push (" brief " );
419424
420425 if (customFilter != null )
421426 {
0 commit comments