Permalink
Browse files

Throwing exception when 'am start' fails on RunMojo#launch. ie: Activ…

…ity doesn't exist
  • Loading branch information...
1 parent 8ab75e4 commit 7835cd8209a9fc49ad4ebb731a4f1143c3420e8a @jonasfa jonasfa committed Dec 8, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/main/java/com/jayway/maven/plugins/android/standalonemojos/RunMojo.java
@@ -16,8 +16,8 @@
package com.jayway.maven.plugins.android.standalonemojos;
import com.android.ddmlib.AdbCommandRejectedException;
+import com.android.ddmlib.CollectingOutputReceiver;
import com.android.ddmlib.IDevice;
-import com.android.ddmlib.NullOutputReceiver;
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.TimeoutException;
import com.jayway.maven.plugins.android.AbstractAndroidMojo;
@@ -283,7 +283,13 @@ public void doWithDevice( IDevice device ) throws MojoExecutionException, MojoFa
{
getLog().info( "Attempting to start " + info.packageName + "/" + info.activity + " on device "
+ device.getSerialNumber() + " (avdName = " + device.getAvdName() + ")" );
- device.executeShellCommand( command, new NullOutputReceiver() );
+
+ CollectingOutputReceiver shellOutput = new CollectingOutputReceiver();
+ device.executeShellCommand( command, shellOutput );
+ if ( shellOutput.getOutput().contains( "Error" ) )
+ {
+ throw new MojoFailureException( shellOutput.getOutput() );
+ }
}
catch ( IOException ex )
{

0 comments on commit 7835cd8

Please sign in to comment.