[Android Software Development] etwalgade:
New issue... exception throw getting connected devices

I got past that issue. Thanks for your help. It was working beautifully, I was getting the directories and files back, I was even able to copy files from the device to my computer.

Then "all of the sudden" (have not been able to trace the root cause), I started getting an exception when trying to get the connected device. I did confirm the device is connected to the computer.

The exception is being thrown in the HandleOutput method of the command class on line 117:

if (p.WaitForExit(timeout) && outputWaitHandle.WaitOne(timeout) && errorWaitHandle.WaitOne(timeout))

{

string strReturn = "";

if (error.ToString().Trim().Length.Equals(0) || forceRegular)

strReturn = output.ToString().Trim();

else

strReturn = error.ToString().Trim();

return strReturn;

}

After I initialize the controller and then try to either get connected devices or get a count of connected devicees, the exception is thrown. Here is my code:

if (connectedDroid == null || String.IsNullOrEmpty(connectedDroid.SerialNumber))

{

if (TheController == null)

{

TheController = AndroidController.Instance;

TheController.WaitForDevice();

}

int devices = TheController.ConnectedDevices.Count;

if (devices > 0)

{

var DeviceName = TheController.ConnectedDevices[0].ToString();

var device = TheController.GetConnectedDevice(DeviceName);

connectedDroid = device;

}

}

In this example, (one of my many variants to get this working again), I am trying to just retrieve a count of the connected devices. Its on that line that the exception is thrown.

--***** Aditional Info****

So the real issue is for some reason I cannot "get" the connected devices, any longer. So I have tried some goofy ways of trying to get something working. Here is my latest:

var devicelist = Adb.ExecuteAdbCommand(Adb.FormAdbCommand("devices"));

String DeviceName = "";

if (devicelist.Length > 20)

{

int newLineIdx = devicelist.IndexOf("\n") + 1;

int tabIdx = devicelist.IndexOf("\t");

DeviceName = devicelist.Substring(newLineIdx, devicelist.Length - tabIdx + 1);

}

connectedDroid = TheController.GetConnectedDevice(DeviceName);

I am successfully getting the device name, aka serial - "04d596c7", but when it gets to the line that says "GetConnectedDevice" it throws and exception that says "The system cannot find the file specified" at " at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)\r\n at System.Diagnostics.Process.Start()\r\n at RegawMOD.Command.HandleOutput(Process p, AutoResetEvent outputWaitHandle, AutoResetEvent errorWaitHandle, Int32 timeout, Boolean forceRegular) in C:\\Code\\Windows Applications\\DroidBackup\\AndroidLib\\Classes\\Util\\Command.cs:line 112\r\n at RegawMOD.Command.RunProcessReturnOutput(String executable, String arguments, Int32 timeout) in C:\\Code\\Windows Applications\\DroidBackup\\AndroidLib\\Classes\\Util\\Command.cs:line 68\r\n at RegawMOD.Android.Fastboot.ExecuteFastbootCommand(FastbootCommand command) in C:\\Code\\Windows Applications\\DroidBackup\\AndroidLib\\Classes\\AndroidController\\Fastboot.cs:line 104\r\n at RegawMOD.Android.Fastboot.Devices() in C:\\Code\\Windows Applications\\DroidBackup\\AndroidLib\\Classes\\AndroidController\\Fastboot.cs:line 38\r\n at RegawMOD.Android.AndroidController.UpdateDeviceList() in C:\\Code\\Windows Applications\\DroidBackup\\AndroidLib\\Classes\\AndroidController\\AndroidController.cs:line 275\r\n at RegawMOD.Android.AndroidController.GetConnectedDevice(String deviceSerial) in C:\\Code\\Windows Applications\\DroidBackup\\AndroidLib\\Classes\\AndroidController\\AndroidController.cs:line 180\r\n at DroidBackup.MainWindow.GetDevice() in C:\\Code\\Windows Applications\\DroidBackup\\DroidBackup\\MainWindow.xaml.cs:line 59"

I am stuck! :(

---------- Post added at 10:01 AM ---------- Previous post was at 09:03 AM ----------

The issue was that somehow, Fastboot.exe got deleted.

I debugged lower and lower into the AndroidLib code until I found the exception was being thrown deep in the code when AndroidLib tries to execute a fastboot command. That is when the "file not found" exception was thrown.

That got me thinking, so I looked in the "C:\Users\usernamehere\AppData\Local\Temp\RegawMOD\AndroidLib" folder.

I saw the adb.exe, but NO fastboot.exe. So extracted the fastboot.exe from the androidlib zip file and placed it in the folder and voiala! it works!

Not sure how I lost it, but if anyone has any idea how that happened or how to prevent it, that would be great. Shoot, I am not sure how those files go in there in the first place, which will be important to know if I want to ever install this on another machine, so if you have any thoughts about that, that would be awesome!