Click here to Skip to main content
15,886,518 members
Articles / Mobile Apps / Android

Setting Up Your Android Development Environment on Windows

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
3 Aug 2014CPOL6 min read 18K   5   3
Article 2 - Setting up Android Studio or Eclipse ADT on Windows

Introduction

This article discusses some of the key differences between Android Studio and Eclipse with the Android Developer Tools (ADT) plugin, before showing how to get them set up on Windows. This article also covers downloading appropriate Android SDK packages and setting up an virtual device to use for testing.

I've also created an alternative article for Ubuntu users.

Android Studio and Eclipse ADT

Android Studio, which is based on IntelliJ IDEA, and Eclipse with the ADT plugin (often just called "ADT") are IDEs for developing Android applications and both offer broadly the same range of features. They both include:

  • An Android build system for compiling your application code and other resources into the .apk file which can be loaded onto an Android phone, or other device.
  • Virtual device emulation for testing your apps.
  • Graphical tools for editing the XML layout files used by your apps activities and fragments.
  • Extra, Android-specific, warnings and suggestions.

Current Status

Eclipse ADT is the older of the two, with Android Studio still being in beta. As of 1st August 2014, the Get the Android SDK page on developers.android.com says:

Quote:

If you're a new Android developer, we recommend you download the ADT Bundle to quickly start developing apps.

So, for the moment at least, Eclipse with the ADT plugin is the official recommended option for new Android developers.

However, the Google tools team have said that development of new tools features is focussed on Android Studio and it seems likely that Android Studio will soon become the primary reccommended Android IDE, perhaps when they reach version 1.0.

New Features in Android Studio

  • Uses Gradle as for its build system instead of Ant. Gradle uses Maven to keep track of your project's dependencies and allows you do build several variants of your application, for example trial and premium versions.
  • More advanced Android code completion using the underlying IntelliJ IDE.
  • Various new upcoming features to enable more efficient Android development, as shown here at Google I/O 2014.

One feature that Eclipse has and Android Studio lacks is Native Development Kit (NDK) support.

Summary

Eclipse with ADT is the older and more mature Android IDE and still the official reccommended option. However, current development effort at Google is focussed on Android Studio which will likely become the reccommended option in the near future.

Setting Up Android Studio

  1. Install the Oracle JDK. Visit the Java SE Development Kit 8 Downloads page and download the appropriate version for your system and then run the downloaded .exe to install the JDK. It should be installed to C:\Program Files\Java\jdk...
  2. To ensure Android Studio will be able to find Javam you need to set the JAVA_HOME environment variable to the path where the JDK was installed. Open Control Panel > System and Security > System, then from the sidebar select 'Advanced system settings'. On the 'Advanced' tab, click the 'Environment Variables...' button, then under 'System variables', click 'New...' and enter 'JAVA_HOME' for the name and 'C:\Program Files\Java\jdk...' (the exact path depends on the JDK version installed.

    Image 1
  3. Go to http://developer.android.com/sdk/installing/studio.html and download the latest version of the Android Studio Bundle for Windows.
  4. Run the .exe installer, ensuring that Android Studio gets installed to 'Program Files (x86)'. It sometimes suggests installing into your 'AppData' folder, which causes trouble later with the SDK Manager.
  5. You should now be able to launch Android Studio from the start menu.

    Image 2
  6. Run Android Studio and ensure you have the latest version by clicking the 'Check' link on the bottom bar:

    Image 3

Android Studio is now set up and ready! Now continue to the section on downloading Android SDK packages below

Setting Up Eclipse ADT

  1. Go to http://developer.android.com/sdk/index.html and download the latest version of the ADT Bundle for Windows.
  2. Extract the the archive to somewhere sensible, C:\Program Files\adt-bundle-windows should be fine.
  3. Once extracted, view the files and find the folder named 'eclipse'. Inside there's an executable eclipse.exe. To make it easier to run Eclipse ADT, right click on this file and then 'Sent to' > 'Desktop (create shortcut)'.
  4. Run Eclipse ADT by clicking the new shortcut on your Desktop, the default "workspace" location should be fine.
  5. Check you have the latest version by going to Help > Check for Updates:

    Image 4

Eclipse ADT is now set up and ready!

Tip: Adding Eclipse Global gitignore Rules

If you're already using, or planning to use Git for version control, you can easily prevent any of Eclipse's temporary/configuration files from being added to any of your repositories using a global .gitignore file.

  1. Create a new empty file in a convenient location e.g. global_gitignore in My Documents.
  2. Copy and paste these rules into that file.
  3. In the Git Bash terminal run the following command to register your global ignore file:
git config --global core.excludesfile ~/.global_gitignore

Downloading Android SDK Packages

So far you've set up your Android IDE, either Android Studio or Eclipse ADT, and installed the core SDK tools. But new SDK components are being released all the time via the Android SDK Manager. Before you can start developing, you need to download some extra packages.

Note: As new versions of Android are released, new packages will become available in the SDK Manager and you will have to download these to gain access to the new APIs and features.

You can open the SDK Manager from the Android Studio welcome screen by clicking on 'Configure' and then 'SDK Manager':

Image 5

Or if you're using Eclipse ADT, just click the 'Android SDK' icon in the top toolbar:

Image 6

Installing the Packages

The typical set of packages to install are:

  • The latest versions of 'Android SDK Tools', 'Android SDK Platform-tools' and Android SDK Build-tools' from the 'Tools' section.
  • All of the packages for the latest Android version.
  • The 'Android Support Library' package from the 'Extras' section.

The SDK Manager will often make a sensible suggestion of which packages to install for you.

Click the 'Install X packages...' button to continue and then accept the licenses.

Setting Up an Android Virtual Device

Virtual devices for testing are configured using the Android Virtual Device (AVD) Manager. This is only accessible from Android Studio after you've set up your first project, so either leave this part for now and come back to it later, or just accept all the default options of the 'New Project...' wizard and then click the 'AVD Manager' icon in the top toolbar

Image 7

If you're using Eclipse ADT, just click the 'Android Virtual Device Manager' icon in the top toolbar:

Image 8

Example Virtual Device

Once you've started the AVD Manager, click 'Create...' to add a new virtual device. Most of the options are self-explanatory and you can see a typical set up below. Note that you need to have downloaded the appropriate system image SDK packages, to have options for the 'CPU/ABI' field.

Image 9

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Cambridge University
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralSuggestion Pin
Ranjan.D4-Aug-14 3:40
professionalRanjan.D4-Aug-14 3:40 
GeneralRe: Suggestion Pin
Max Spencer4-Aug-14 7:53
Max Spencer4-Aug-14 7:53 
QuestionBroken images Pin
thatraja3-Aug-14 20:58
professionalthatraja3-Aug-14 20:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.