3030import java .util .regex .Pattern ;
3131
3232import processing .app .ui .Editor ;
33+ import processing .app .Messages ;
3334import processing .app .RunnerListener ;
3435import processing .app .SketchException ;
3536import 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