So, I am sitting at work having just finished a big production deployment. There's a couple of weeks of wait time, and we have a big mobile project on the horizon, but company policy is preventing access to https sites. We have been given a directive to start learning Android development.
So, I type Android tutorial in google, get the website, get on eclipse and try to add the ADT plug-in. Voila – error. Cannot connect to the https site. A wise friend told me use http instead. So I did that. But still had to install the SDK, the platform, the APIs, the tools. The whole hoopla. So I googled again, and for once found no direct result. Spent nearly 4 hours going through a plethora of results, which google so kindly serves up for any query. Thought I had it all down, but could not get to set up an Android Virtual Device, cause the AVD manager could not locate the API. But then I remembered Denny Crane from Boston Legal, and how he started a company based on "What If" And "HE did it". Well, "I did it too!!"
So without further ado, here are the steps to follow to set up YOUR Android Dev environment if you are behind a firewall and cannot circumvent it through a proxy ;)
- Installing ADT plug–in : After downloading and installing eclipse, Click on Help->Install New Software. Click on Add. And in the URL, use http://dl-ssl.google.com/android/eclipse/ - Note http instead of https.
- Choose all the default install options, Restart eclipse – Voila ADT is set up.
- Downloading the SDK – This was the easy part, since you just google "Download Android SDK", it takes you to a site, typically http://developer.android.com/sdk/index.html. Choose either the zip (longer to download, faster to install – just unzip anywhere you please. I chose C:\Program Files\Android\) or the exe – (faster to download, longer to install)
- Lets say you chose the zip version, and unzipped to the folder specified above. You will now see the following sub-folders in the folder C:\Program Files\Android\android-sdk - tools, add-ons and platforms.
- If by now, you have seen all the other tutorials you would have seen screen-shots of the AVD manager showing all sorts of things like Platform, Google API etc etc. Well, through the AVD YOU (and as was evident after hours of frustration, I) can't get those, since the firewall very graciously refuses to connect to any of the sites. So we gotta get all of them manually.
- Go to "http://dl-ssl.google.com/android/repository/repository.xml" on your browser
- Here, you will see a list of Platforms, platform tools, samples and docs.
- To download a platform, look for the platform version you want. I chose android 2.3.1 Rev 2. To download, simply use http://dl-ssl.google.com/android/repository/android-2.3.1_r02-linux.zip (The name of zip file can be found under the sdk-archives tag, of the platform you choose)
- Important and very frustrating step for me: Extract the contents of this file to C:\Program Files\Android\android-sdk\platforms folder, not the root C:\Program Files\Android\android-sdk folder. Thank you http://developer.android.com/guide/developing/devices/managing-avds-cmdline.html - Why you ask? Because it was this line "The
androidtool scans the
/add-ons/directories looking for valid system images and then generates the list of targets. Here's an example of the command output:" that helped me move the extracted file to the platforms folder!!
- Download API: To do this, you have to go to the Google API Add on site. Again, the AVD manager refused to connect to http or https. So, in your browser, type in http://dl-ssl.google.com/android/repository/addon.xml (This is the inner link found on https://dl-ssl.google.com/android/repository/addons_list.xml, which of course you cannot access J )
- The API level for my Platform is 9. You can find this by looking at the tag at http://dl-ssl.google.com/android/repository/repository.xml under your selected platform
- Download the zip file, in my case http://dl-ssl.google.com/android/repository/google_apis-9_r02.zip, and extract to the C:\Program Files\Android\android-sdk\add-ons folder
- Now, if you run the SDK Manager.exe, once you go past the frustrating several cannot connect messages the come on start-up, Click on Installed packages
- You will see, Thank the Lord, Android SDK Tool Revision 12 (or whatever is the latest revision of the SDK), SDK Android Platform , and Google APIs by Google Inc.
- All the three are necessary for you to be able to create a new Android Virtual Device, which you can do following the steps here - http://developer.android.com/guide/developing/devices/managing-avds.html
- Extra Note : You can also download relevant Platform Tools, Samples etc by downloading (locating them from http://dl-ssl.google.com/android/repository/repository.xml) and extracting the zip file contents to C:\Program Files\Android\android-sdk folder.
Good Luck my fellow mobile programmer!