Skip to content

Commit 93fd886

Browse files
committed
show additional warning message when connection is lost with emulator
1 parent 7febcb6 commit 93fd886

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/processing/mode/android/AndroidRunner.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.regex.Pattern;
3131

3232
import processing.app.ui.Editor;
33+
import processing.app.Messages;
3334
import processing.app.RunnerListener;
3435
import processing.app.SketchException;
3536
import processing.mode.java.runner.Runner;
@@ -98,7 +99,18 @@ public void launch(Future<Device> deviceFuture, boolean wear) {
9899
listener.statusNotice("Installing sketch on " + device.getId());
99100
// this stopped working with Android SDK tools revision 17
100101
if (!device.installApp(build, listener)) {
101-
listener.statusError("Lost connection with device while installing. Try again.");
102+
if (device.getId().contains("emulator")) {
103+
// More detailed message when using the emulator, to following discussion in
104+
// https://code.google.com/p/android/issues/detail?id=104305
105+
listener.statusError("Lost connection with emulator while installing. Try again.");
106+
Messages.showWarning("The emulator is slooow...",
107+
"This is common when the emulator is booting up for the first time.\n" +
108+
"Just try again once the emulator is ready, or set the\n" +
109+
"ADB_INSTALL_TIMEOUT environmental variable to have a.\n" +
110+
"longer timeout, for example 5 minutes or more");
111+
} else {
112+
listener.statusError("Lost connection with device while installing. Try again.");
113+
}
102114
Devices.killAdbServer(); // see above
103115
return;
104116
}
@@ -111,8 +123,8 @@ public void launch(Future<Device> deviceFuture, boolean wear) {
111123
// monitor.setNote("Starting sketch on " + device.getId());
112124
listener.statusNotice("Starting sketch on " + device.getId());
113125
if (startSketch(build, device)) {
114-
listener.statusNotice("Sketch launched on the "
115-
+ (device.isEmulator() ? "emulator" : "device") + ".");
126+
listener.statusNotice("Sketch launched "
127+
+ (device.isEmulator() ? "in the emulator" : "on the device") + ".");
116128
} else {
117129
listener.statusError("Could not start the sketch.");
118130
}

0 commit comments

Comments
 (0)