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 ); } } } );
/** * Uninstalls an package from the device. * * @param packageName the Android application package name to uninstall * @return a {@link String} with an error code, or <code>null</code> if success. * @throws InstallException if the uninstallation fails. */ @Override public String uninstallPackage(String packageName) throws InstallException { return device.uninstallPackage(packageName); }
@Override public void uninstallPackage(String packageName) throws AndroidExecutionException { try { delegate.uninstallPackage(packageName); } catch (InstallException e) { throw new AndroidExecutionException("Unable to uninstall APK named " + packageName, e); } }
@Override public void uninstallPackage(String packageName) throws AndroidExecutionException { try { delegate.uninstallPackage(packageName); } catch (InstallException e) { throw new AndroidExecutionException("Unable to uninstall APK named " + packageName, e); } }
@Override public void uninstallPackage(String packageName) throws AndroidExecutionException { try { delegate.uninstallPackage(packageName); } catch (InstallException e) { throw new AndroidExecutionException("Unable to uninstall APK named " + packageName, e); } }
private void reinstall(final IDevice device, final String appPackage, final File appApk) { final String message = format("Error while installing %s on %s", appPackage, device.getSerialNumber()); tryThrice(true, message, () -> { try { logger.debug("Uninstalling {} from {}", appPackage, device.getSerialNumber()); device.uninstallPackage(appPackage); logger.debug("Installing {} to {}", appPackage, device.getSerialNumber()); device.installPackage(appApk.getAbsolutePath(), true, optionalAutoGrantPermissionFlag(device)); } catch (InstallException e) { throw new RuntimeException(message, e); } }); }
@Override public void uninstallPackage(@NonNull String packageName, int timeout, ILogger logger) throws DeviceException { try { iDevice.uninstallPackage(packageName); } catch (Exception e) { logger.error(e, "Unable to uninstall " + packageName); throw new DeviceException(e); } }
@Override public void uninstallPackage(@NonNull String packageName, int timeout, ILogger logger) throws DeviceException { try { iDevice.uninstallPackage(packageName); } catch (Exception e) { logger.error(e, "Unable to uninstall " + packageName); throw new DeviceException(e); } }