protected void deployApk ( final File apkFile ) throws MojoExecutionException , MojoFailureException { if ( undeployBeforeDeploy ) { undeployApk ( apkFile ) ; } doWithDevices ( new DeviceCallback ( ) { public void doWithDevice ( final IDevice device ) throws MojoExecutionException { String deviceLogLinePrefix = DeviceHelper . getDeviceLogLinePrefix ( device ) ; try { device . installPackage ( apkFile . getAbsolutePath ( ) , true ) ; getLog ( ) . info ( deviceLogLinePrefix + "Successfully installed " + apkFile . getAbsolutePath ( ) ) ; getLog ( ) . debug ( " to " + DeviceHelper . getDescriptiveName ( device ) ) ; } catch ( InstallException e ) { throw new MojoExecutionException ( deviceLogLinePrefix + "Install of " + apkFile . getAbsolutePath ( ) + " failed." , e ) ; } } } ) ; }
Deploys an apk file to a connected emulator or usb device .