Thursday, June 30, 2011

Android SDK on Windows for Dummies: A focus on the debuggin part


I have recently started developing android apps on Windows 7 (life sucks, everyday I wish I were on Linux, but it is what it is). Today for testing my apps I was given a very unique smart phone from a dubious manufacturer. Since it was not the typical android phone, the normal procedures from : http://developer.android.com/sdk/win-usb.html#WinUsbDriver did not seem to work :( I followed all of Google's instructions. But when I tried to update the driver I encountered a few problems: windows asked me where to search for the driver software, and I selected: "Browse my Computer for driver software", then clicked "Browse" and Explore to C:\Android\usb_driver. I also checked the "Include Subfolders", clicked Next and... I got the following error message: "Windows was unable to install your android phone"

After hours and hours of working around it, I finally found a solution to the problem and thought I'd share it, so people can avoid some of the pitfalls I encountered and the installation will hopefully not be as challenging as it was for me.

Basically what worked for me was to download PdaNet for android from : http://www.junefabrics.com/android/download.php . I installed PdaNet with the phone connected to the PC and android was up and running (and not suspended).

PdaNet is technically a tool for supplying Internet access to an unconnected device from a device (such as a mobile phone) which does have Internet access. I believe PdaNet is useful in this case, because it automatically sets up all of the environment for having communication between the computer and the phone.

Once PdaNet has been successfully installed, I ran from a windows command propt "adb.exe" and "fastboot.exe". Now, when I ran the latter, I received a message stating that a .dll file was not found, I search for that file, and added its location to my path.
Here it might be important to state that adb.exe is the "android debug bridge", a tool that can deal with the emulator or the device. Fastboot on the other hand, is a diagnostic protocol used primarily to modify the flash file system in Android smart phones from another computer over a USB connection.

With this,I had communication with my android phone!

One can test it out, by typing in a command propt: adb devices and obtain a list of connected devices, including the phone. With that communication between our device and our computer is achieved, so running and testing our application is now a cinch.
happy hacking :)