Android Open Source - adb-idea Uninstall Command






From Project

Back to project page adb-idea.

License

The source code is released under:

Apache License

If you think the Android project adb-idea listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.developerphil.adbidea.adb.command;
/*w  w w  . java  2s  .  com*/
import com.android.ddmlib.IDevice;
import com.android.ddmlib.InstallException;
import com.intellij.openapi.project.Project;
import org.jetbrains.android.facet.AndroidFacet;

import static com.developerphil.adbidea.ui.NotificationHelper.error;
import static com.developerphil.adbidea.ui.NotificationHelper.info;

public class UninstallCommand implements Command {
    @Override
    public boolean run(Project project, IDevice device, AndroidFacet facet, String packageName) {
        try {
            String errorCode = device.uninstallPackage(packageName);
            if (errorCode == null) {
                info(String.format("<b>%s</b> uninstalled on %s", packageName, device.getName()));
                return true;
            } else {
                error(String.format("<b>%s</b> is not installed on %s", packageName, device.getName()));
            }
        } catch (InstallException e1) {
            error("Uninstall fail... " + e1.getMessage());
        }
        return false;
    }
}




Java Source Code List

com.developerphil.TestProjectMultiModule.MyActivity.java
com.developerphil.adbidea.action.AdbAction.java
com.developerphil.adbidea.action.ClearDataAction.java
com.developerphil.adbidea.action.ClearDataAndRestartAction.java
com.developerphil.adbidea.action.KillAction.java
com.developerphil.adbidea.action.RestartAction.java
com.developerphil.adbidea.action.StartAction.java
com.developerphil.adbidea.action.UninstallAction.java
com.developerphil.adbidea.adb.AdbFacade.java
com.developerphil.adbidea.adb.AdbUtil.java
com.developerphil.adbidea.adb.command.ClearDataAndRestartCommand.java
com.developerphil.adbidea.adb.command.ClearDataCommand.java
com.developerphil.adbidea.adb.command.CommandList.java
com.developerphil.adbidea.adb.command.Command.java
com.developerphil.adbidea.adb.command.KillCommand.java
com.developerphil.adbidea.adb.command.RestartPackageCommand.java
com.developerphil.adbidea.adb.command.StartDefaultActivityCommand.java
com.developerphil.adbidea.adb.command.UninstallCommand.java
com.developerphil.adbidea.adb.command.receiver.GenericReceiver.java
com.developerphil.adbidea.ui.DeviceChooserDialog.java
com.developerphil.adbidea.ui.ModuleChooserDialogHelper.java
com.developerphil.adbidea.ui.NotificationHelper.java
com.example.SecondModule.MySecondModuleActivity.java
com.example.app.MainActivity.java
com.example.untitled.MyActivity.java
org.joor.ReflectException.java
org.joor.Reflect.java