/// <summary> /// Attach connection to emulator /// </summary> /// <param name="lineNumber"></param> /// <param name="caller"></param> public void ConnectEmulator([CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { var errorCount = 0; Loop: try { adbController = new AdbController(AdbPath, logger); adbController.SelectDevice(emulator.AdbIpPort()); adbController.WaitDeviceStart(); minitouchController = new MinitouchController(adbController, MinitouchPath, TapScale); minitouchController.Install(); adbController.Execute("input keyevent KEYCODE_HOME"); Thread.Sleep(3000); adbController.Execute("settings put system font_scale 1.0"); emulator.UnUnbotify(this); logger.WriteLog("Emulator Connection Success!"); } catch (Exception ex) { errorCount++; if (errorCount > 15) { logger.WriteLog(ex.Message, Color.Red); StopEmulator(); Thread.Sleep(3000); errorCount = 0; } StartEmulator(); Thread.Sleep(1000); goto Loop; } }