Setting up an Android dev environ on Windows

My first foray into the Kindle Fire development environment


The urge struck me the other day to try developing a simple application for Android. To get started at a low cost I purchased the Kindle Fire. Probably not the ideal development platform to start with, but it was cheap and quick to obtain.

Aren't there many, many pages out there on how to set up for Kindle Fire development? Yes! However, I found I had to search through quite a few of them to piece together the entire setup process. Thus, I am documenting it here for my later use should I need to re-install it.

Note that the Kindle Fire is not running the latest release of Android. It appears to be running a branch of the 2.3 (Gingerbread) OS. You can see more information about that on Wikipedia here: http://en.wikipedia.org/wiki/Kindle_Fire Be sure that when you are developing your application you develop to that version of Android. There is a lot that has been added since then. Don't start using any of those new features; your app won't work (or so I understand)!

Hardware that you need


A Kindle Fire. Order one from Amazon.

A development PC. This doesn't have to be a high-end machine. Whatever you have sitting around should be just fine.

A USB cable. You need a cable to connect your PC to the Kindle Fire. At least, you do if you want to copy your application onto the Kindle Fire using USB. Some other people have said they have had good luck using DropBox. They upload the candidate app from their PC and they use the Kindle Fire DropBox app to download the candidate app to their Kindle. However you end up doing it, you will need a way to copy files. I chose to use the USB cable. One end of the USB cable (the one that plugs into your PC) should be a USB 2.0 or USB 3.0 full-size connector. The other end (the one that plugs into your Kindle) will be a USB micro-B connector. I *highly* recommend going to a store that will let you try connecting the cable to your Kindle before you buy it. I found several cables marked USB micro-B. Only one of them fit into my Kindle. Apparently, there are several variants of the micro-B standard.

Configure the Kindle Fire


By default, the Kindle Fire does not allow you to install and run development builds. Enabling that is relatively simple. To allow development apps to be loaded onto it:
  • Turn on your Kindle Fire
  • Tap on the gear icon in the upper right
  • Tap on "More..."
  • Tap on "Device"
  • Set "Allow Installation of Applications (From Unknown Sources)" to ON
Now when you copy your development application onto your Kindle you can install it. There's one step more that you need to do, though. You need to install an application that will let you install applications. Yes, I know that sounds strange. However, there does not appear to be a way on the Kindle Fire to install an application bundle that has been copied onto it.
  • Turn on your Kindle Fire
  • Tap on the Home icon
  • Tap on "Apps"
  • Tap on "Store >"
  • Type "File Manager" into the search field
  • Tap on "Search"
  • Locate "File Manager (Kindle Fire Edition)"
  • Tap on "FREE"
  • Tap on "Get App"

Now you have a file system browsing application installed. When you start this application, navigate to where you have stored your development app. Tap on your app and it will install.  Remember to re-install your app each time you copy a new version to your Kindle Fire.


Configure a Windows 7 64-bit development PC


I have two development environments. The first one I set up is a Dell Vostro notebook running Windows 7 64-bit. The second is a Toshiba notebook running Windows 7 64-bit as the host OS and Windows Server 2008 R2 Enterprise Edition 64-bit as the guest OS (using VMware Workstation). Here are the notes I took when I installed the development environment on the Windows 7 OS.

Install Java. Android development is done in Java.
  • Download version 1.5 or later of Java SE JDK
  • http://www.oracle.com/technetwork/java/javase/downloads/index.html

Set the JAVA_HOME environment variable and PATH
  • JAVA_HOME c:\program files\Java\jre7
  • PATH %PATH%;%JAVA_HOME%\bin

Download the Android SDK
  • http://developer.android.com/sdk/index.html

Install the Android SDK
  • http://developer.android.com/sdk/installing/index.html
  • When done, it will ask if you want to run the updater. Do that.

The version of the Android SDK that you download won't have all of the various addons that you will need. Update the Android SDK.
  • Install all Tools
  • Install all Android 4.1 API items
  • Install Google USB driver
  • Install Android 2.3.3 (API 10) <- Kindle Fire
  • WARNING: ONLY check the items you want to install...checking items that are already installed will delete them!

Set the SDK_ROOT environment variable and update the PATH
  • SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
  • PATH=%PATH%;%JAVA_HOME%\bin;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools

I know that a lot of people out there really don't like Eclipse. I have not used it enough yet to make a call either way. However, almost all of the examples I've run across tell you how to do <whatever> assuming that you have the Eclipse IDE. Take the plunge and start using Eclipse. If you are a pro, you could certainly skip this step! Download Eclipse IDE for Java developer.
  • http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/junor
  • Click on the Windows 64-bit link
  • There is no installer. Just copy the downloaded tree into c:\Program Files

Download and install Notepad++. Why? Because it is a really useful tool. Any Windows installation should have it.
  • http://notepad-plus-plus.org/

Add the Android Eclipse Plugin (ADT) to Eclipse:
  • Run Eclipse.
  • Select Help->Install New Software…
  • In the “Work with:” field, replace the “type or select a site” with “https://dl-ssl.google.com/android/eclipse/”.
  • Expand “Developer Tools”.
  • Check the “Android Development Tools” box.
  • Click Next, Next, select Accept License…, click Next.
  • Accept the unsigned warning to continue installation.
  • Restart Eclipse.

Configure the ADT:
  • Under Eclipse, go to menu Windows->Preferences.
  • Select Android
  • In the “SDK Location”, browse to your android install directory %SDK_ROOT%.
  • Hit Apply and you should see the Android platform versions you installed earlier populate the table.

Set up the USB driver

There are two files you need to edit. The paths I give below are where the files are on my installation. Your system may vary.
  • C:\Users\<your username>\.android\adb_usb.ini
  • Go to the end of the file and add this line:
    • 0x1949


  • C:\Program Files (x86)\Android\android-sdk\extras\google\usb_driver\android_winusb.inf
  • Add these lines to the [Google.NTx86] and [Google.NTamd64] sections
    • ;Kindle Fire
    • %SingleAdbInterface% = USB_Install, USB\VID_1949&PID_0006
    • %CompositeAdbInterface% = USB_Install, USB\VID_1949&PID_0006&MI_01

Acknowledgements: There are many, many sites that I stumbled through trying to get started in Android development. Unfortunately, I kept a record of only a few of them. Here are those few:

http://mobile.tutsplus.com/tutorials/android/getting-started-with-kindle-fire-development/
http://javasrilankansupport.blogspot.com/2012/04/how-to-setup-android-application.html
http://www.doitscared.com/546/setup-android-development-on-windows-7-64bit/


Comments

Popular posts from this blog

Patching VMware Tools in Fedora 18

Programming language notes, links

Setting up gdb in Fedora