Wednesday, January 9, 2013

Android Development Setup on a Windows 7, 64-bit Environment with TFS

The nice thing about doing Android development is that the tools are all free, allowing you to delve into mobile development without laying out any cash. Getting started with Android development is simply a matter of downloading and installing a handful of tools.  You could start with Google's Android Bundle which includes many of the tools listed below in a single download.  But sometimes the best way to learn a new development platform is by installing each of its components manually.

Below are instructions targeted for a Windows7 64-bit environment and using Team Foundation Server (TFS) for source control.  Note that the software versions mentioned below are current as of January 2013. 

  1. Install Java

    Install the Java SDK version 7, update 10.  Download the installer from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.  When installing, choose all the default options.
     
    
  2. Install Eclipse

    There are a handful of Java IDEs available, but these instructions will guide you on installing Eclipse.  It's free and has a large community following.  Get the Juno release installer for mobile development on Windows 7, 64-bit at http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/SR1/eclipse-mobile-juno-SR1-win32-x86_64.zip.  Extract the files to C:\Program Files.

    Once extracted, edit the C:\Program Files\eclipse\eclipse.ini file using WordPad.  Include the lines:

    -vm
    C:\Program Files\Java\jre7\bin
    

    Then save the file.  I suggest WordPad because the eclipse.ini file may come with Unix-style line breaks, something other editors might not handle.  This change allows the Eclipse application to be pinned to the taskbar, as described in http://brianreiter.org/2010/07/15/pin-eclipse-helios-to-windows-7-taskbar.  Because the file is located in a Program Files directory, you might need to launch WordPad as an administrator depending upon your security settings. 
  3.  
    
  4. Install Android Developer Tools

    Eclipse doesn't natively support the development of Android applications.  To do that you'll need to install the developer tools.  To do this, launch Eclipse and select the Help > Install New Software menu item.  Click the "Add" button.  For the name, enter "Android", and for the location, enter https://dl-ssl.google.com/android/eclipse (if for some reason https fails, try http).  At a minimum, check "Android DDMS" and "Android Development Tools".  Choose all the default options thereafter and then "Finish".  If prompted, click OK to allow unsigned content.  Don't restart Eclipse...simply exit.
  5.  
    
  6. Install the Android SDK

    Download the Android SDK from http://developer.android.com/sdk/index.html.  Don't download the entire bundle, because we've already installed Eclipse.  Just download the SDK Tools for Windows installer and launch it.  Choose whether to install for just you, or all users.  Choose all the default options thereafter and then "Finish". 

    The Android SDK Manager will be launched automatically by the installer.  This will allow you to download the Android API packages.  The packages you download will depend upon the devices on which you plan to run, the API version for which can be found on your device in Settings > About Phone > Android Version.  Note that other API versions can be installed at any time by re-running the SDK Manager.exe.  Along with the API, install the"Android Support Library" under Extras. 

    If you attempt to install all components at once and receive errors, or they continue to be shown as "Not Installed" even after what appeared to be a successful install, try installing one feature at a time.  Occasionally the SDK Manager has trouble installing multiple features at once and will error or silently fail.
  7.  
    
  8. Setup Android Virtual Device

    To test your application in the absence of a physical Android device you'll need a virtual one.  Create a virtual device with characteristics that resemble your physical one by launching the Android Virtual Device Manager.  To do this, launch Eclipse and select Window > Android Virtual Device Manager.  Click "New" to create a virtual device that match your device's specifications.
  9.  
    
  10. Install the Team Foundation Server plugin

    To enable Eclipse to use TFS, launch Eclipse and go to the Help > Install New Software menu item.  Click the "Add" button.  For the name, enter "TFS", and for the location, enter http://dl.microsoft.com/eclipse/tfs.  Check all features.  Choose all the default options thereafter and then "Finish".  Then restart Eclipse.
  11.  
    
  12. Ignore binaries in source control

    Binary files don't belong under source control.  But you have explicitly to tell Eclipse to ignore them, otherwise they'll be added by default.  In Eclipse, go to Window > Preferences > Team > Ignored Resources > Add Pattern..., and add */bin/* (per http://msdn.microsoft.com/en-us/library/gg413275%28v=vs.100%29.aspx).
  13.  
    
  14. Connect to TFS

    Eclipse must be connected to a TFS server in much the same way that Visual Studio is.  Launch Eclipse and go to the Window > Open Perspective > Other... > Team Foundation Server Exploring option.  Click Connect to Team Projects > Servers... > Add, and enter the server name, path, port, and protocol (the last three are typically "tfs", "8080", and "http", respectively).
  15.  
    
  16. Install device USB driver

    In order to connect your device to your desktop, you'll need to install the device specific USB driver.  I happen to have a Hauwei device, the driver for which I found at http://download-c.huawei.com/tcpsdownload/downLoadCenter?category=&flay=software&downloadID=Mzk1MzA=.
  17.  
    
  18. Enable debugging

    Once you get started you're bound to run into issues that you'll want to debug.  To do this, you must enable debugging on both the device and within your Android project.  To enable debugging on the device, go to Settings > Applications > Development, and check "USB debugging".    From within Eclipse project, open the application AndroidManifest.xml, and on the Application tab set Debuggable to "true".
  19.  
    

1 comment:

  1. I have gone through your article on PHP version 7 which is going to be release soon. Definitely PHP 7 helps developers in different ways as you said. I am waiting for your next article after the release of PHP 7 Version. Kindly update your knowledge with us.
    Regards:
    PHP Course Chennai
    learn PHP

    ReplyDelete