protected boolean undeployApk ( final String packageName ) throws MojoExecutionException , MojoFailureException { final AtomicBoolean result = new AtomicBoolean ( true ) ; // if no devices are present, it counts as successful doWithDevices ( new DeviceCallback ( ) { public void doWithDevice ( final IDevice device ) throws MojoExecutionException { String deviceLogLinePrefix = DeviceHelper . getDeviceLogLinePrefix ( device ) ; try { device . uninstallPackage ( packageName ) ; getLog ( ) . info ( deviceLogLinePrefix + "Successfully uninstalled " + packageName ) ; getLog ( ) . debug ( " from " + DeviceHelper . getDescriptiveName ( device ) ) ; result . set ( true ) ; } catch ( InstallException e ) { result . set ( false ) ; throw new MojoExecutionException ( deviceLogLinePrefix + "Uninstall of " + packageName + " failed." , e ) ; } } } ) ; return result . get ( ) ; }
Undeploys an apk specified by package name from a connected emulator or usb device . Also deletes the application s data and cache directories on the device .