Example #1
0
        public AdbStartServerProcess(AndroidToolbox tb, EventHandler exited)
        {
            this.exited = exited;

            proc           = new System.Diagnostics.Process();
            proc.StartInfo = new System.Diagnostics.ProcessStartInfo(tb.AdbExe, "start-server")
            {
                UseShellExecute        = false,
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                CreateNoWindow         = true,
            };
            proc.StartInfo.EnvironmentVariables["PATH"] = tb.AdbPathOverride;
            proc.Start();

            captureOutputThread = new Thread(CaptureOutput)
            {
                Name         = "Adb output reader",
                IsBackground = true,
            };
            captureOutputThread.Start();

            /*
             * captureErrorThread = new Thread (CaptureError) {
             *      Name = "Adb error reader",
             *      IsBackground = true,
             * };
             * captureErrorThread.Start ();*/
        }
        internal static void UpdateSdkLocations()
        {
            try {
                var oldAndroidBinDir = AndroidBinDir;

                MonoDroidToolsDir = MonoDroidFrameworkDir = AndroidBinDir = JavaBinDir = null;
                Toolbox           = null;
                EnvironmentOverrides.Remove("PATH");

                string monoDroidToolsDir, monoDroidFrameworkDir, javaPath, androidPath;
                MonoDroidSdk.GetPaths(out monoDroidToolsDir, out monoDroidFrameworkDir, out androidPath, out javaPath,
                                      new Microsoft.Build.Utilities.TaskLoggingHelper());

                if (monoDroidToolsDir == null)
                {
                    LoggingService.LogInfo("Mono for Android SDK not found, disabling Mono for Android addin");
                    return;
                }

                MonoDroidToolsDir     = monoDroidToolsDir;
                MonoDroidFrameworkDir = monoDroidFrameworkDir;

                if (androidPath == null)
                {
                    LoggingService.LogError("Android SDK not found, needed by Mono for Android addin");
                    return;
                }

                if (javaPath == null)
                {
                    LoggingService.LogError("Java SDK not found, needed by Mono for Android addin");
                    return;
                }

                JavaBinDir    = Path.Combine(javaPath, "bin");
                AndroidBinDir = androidPath;

                EnvironmentOverrides ["PATH"] =
                    AndroidBinDir + Path.PathSeparator +
                    JavaBinDir + Path.PathSeparator +
                    Environment.GetEnvironmentVariable("PATH");

                Toolbox = new AndroidToolbox(AndroidBinDir, JavaBinDir);

                if (oldAndroidBinDir != AndroidBinDir)
                {
                    DeviceManager.AndroidSdkChanged();
                }
            } catch (Exception ex) {
                LoggingService.LogError("Error detecting Mono for Android SDK", ex);
            }
        }
		internal static void UpdateSdkLocations ()
		{
			try {
				BinDir = FrameworkDir = AndroidBinDir = JavaBinDir = null;
				Toolbox = null;
				EnvironmentOverrides.Remove ("PATH");
				
				string monodroidPath, javaPath, androidPath;
				MonoDroidSdk.GetPaths (out monodroidPath, out androidPath, out javaPath);
				
				if (monodroidPath == null) {
					LoggingService.LogInfo ("MonoDroid SDK not found, disabling MonoDroid addin");
					return;
				}
				
				BinDir = Path.Combine (monodroidPath, "bin");
				FrameworkDir = ((FilePath)monodroidPath).Combine ("lib", "mono", "2.1");
				
				if (androidPath == null) {
					LoggingService.LogError ("Android SDK not found, needed by MonoDroid addin");
					return;
				}
				
				if (javaPath == null) {
					LoggingService.LogError ("Java SDK not found, needed by MonoDroid addin");
					return;
				}
				
				JavaBinDir = Path.Combine (javaPath, "bin");
				AndroidBinDir = Path.Combine (androidPath, "tools");
				
				EnvironmentOverrides ["PATH"] =
					AndroidBinDir + Path.PathSeparator + 
					JavaBinDir + Path.PathSeparator + 
					Environment.GetEnvironmentVariable ("PATH");
				
				Toolbox = new AndroidToolbox (AndroidBinDir, JavaBinDir);
			} catch (Exception ex) {
				LoggingService.LogError ("Error detecting MonoDroid SDK", ex);
			}
		}
		internal static void UpdateSdkLocations ()
		{
			try {
				var oldAndroidBinDir = AndroidBinDir;
				
				MonoDroidToolsDir = MonoDroidFrameworkDir = AndroidBinDir = JavaBinDir = null;
				Toolbox = null;
				EnvironmentOverrides.Remove ("PATH");
				
				string monoDroidToolsDir, monoDroidFrameworkDir, javaPath, androidPath;
				MonoDroidSdk.GetPaths (out monoDroidToolsDir, out monoDroidFrameworkDir, out androidPath, out javaPath,
					new Microsoft.Build.Utilities.TaskLoggingHelper ());
				
				if (monoDroidToolsDir == null) {
					LoggingService.LogInfo ("Mono for Android SDK not found, disabling Mono for Android addin");
					return;
				}
				
				MonoDroidToolsDir = monoDroidToolsDir;
				MonoDroidFrameworkDir = monoDroidFrameworkDir;
				
				if (androidPath == null) {
					LoggingService.LogError ("Android SDK not found, needed by Mono for Android addin");
					return;
				}
				
				if (javaPath == null) {
					LoggingService.LogError ("Java SDK not found, needed by Mono for Android addin");
					return;
				}
				
				JavaBinDir = Path.Combine (javaPath, "bin");
				AndroidBinDir = androidPath;
				
				EnvironmentOverrides ["PATH"] =
					AndroidBinDir + Path.PathSeparator + 
					JavaBinDir + Path.PathSeparator + 
					Environment.GetEnvironmentVariable ("PATH");
				
				Toolbox = new AndroidToolbox (AndroidBinDir, JavaBinDir);
				
				if (oldAndroidBinDir != AndroidBinDir)
					DeviceManager.AndroidSdkChanged ();
				
			} catch (Exception ex) {
				LoggingService.LogError ("Error detecting Mono for Android SDK", ex);
			}
		}
Example #5
0
		public AdbStartServerProcess (AndroidToolbox tb, EventHandler exited)
		{
			this.exited = exited;
			
			proc = new System.Diagnostics.Process ();
			proc.StartInfo = new System.Diagnostics.ProcessStartInfo (tb.AdbExe, "start-server") {
				UseShellExecute = false,
				RedirectStandardOutput = true,
				RedirectStandardError = true,
				CreateNoWindow = true,
			};
			proc.StartInfo.EnvironmentVariables["PATH"] = tb.AdbPathOverride;
			proc.Start ();
			
			captureOutputThread = new Thread (CaptureOutput) {
				Name = "Adb output reader",
				IsBackground = true,
			};
			captureOutputThread.Start ();
			
			/*
			captureErrorThread = new Thread (CaptureError) {
				Name = "Adb error reader",
				IsBackground = true,
			};
			captureErrorThread.Start ();*/
		}