Search in sources :

Example 1 with InstantRunPushFailedException

use of com.android.tools.fd.client.InstantRunPushFailedException in project android by JetBrains.

the class HotSwapTask method perform.

@Override
public boolean perform(@NotNull final IDevice device, @NotNull LaunchStatus launchStatus, @NotNull ConsolePrinter printer) {
    InstantRunManager manager = InstantRunManager.get(myProject);
    UpdateMode updateMode = null;
    try {
        InstantRunClient instantRunClient = InstantRunManager.getInstantRunClient(myInstantRunContext);
        if (instantRunClient == null) {
            return terminateLaunch(launchStatus, "Unable to connect to application. Press Run or Debug to rebuild and install the app.");
        }
        updateMode = manager.pushArtifacts(device, myInstantRunContext, myRestartActivity ? UpdateMode.WARM_SWAP : UpdateMode.HOT_SWAP);
        printer.stdout("Hot swapped changes, activity " + (updateMode == UpdateMode.HOT_SWAP ? "not restarted" : "restarted"));
    } catch (InstantRunPushFailedException | IOException e) {
        return terminateLaunch(launchStatus, "Error installing hot swap patches: " + e);
    }
    InstantRunStatsService.get(myProject).notifyDeployType(DeployType.HOTSWAP, myInstantRunContext, device);
    return true;
}
Also used : InstantRunClient(com.android.tools.fd.client.InstantRunClient) UpdateMode(com.android.tools.fd.client.UpdateMode) InstantRunPushFailedException(com.android.tools.fd.client.InstantRunPushFailedException) IOException(java.io.IOException)

Aggregations

InstantRunClient (com.android.tools.fd.client.InstantRunClient)1 InstantRunPushFailedException (com.android.tools.fd.client.InstantRunPushFailedException)1 UpdateMode (com.android.tools.fd.client.UpdateMode)1 IOException (java.io.IOException)1