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
- 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...
- 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.
- Go to http://developer.android.com/sdk/installing/studio.html and download the latest version of the Android Studio Bundle for Windows.
- 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.
- You should now be able to launch Android Studio from the start menu.
- Run Android Studio and ensure you have the latest version by clicking the 'Check' link on the bottom bar:
Android Studio is now set up and ready! Now continue to the section on downloading Android SDK packages below
Setting Up Eclipse ADT
- Go to http://developer.android.com/sdk/index.html and download the latest version of the ADT Bundle for Windows.
- Extract the the archive to somewhere sensible,
C:\Program Files\adt-bundle-windows
should be fine. - 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)'. - Run Eclipse ADT by clicking the new shortcut on your Desktop, the default "workspace" location should be fine.
- Check you have the latest version by going to Help > Check for Updates:
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.
- Create a new empty file in a convenient location e.g. global_gitignore in My Documents.
- Copy and paste these rules into that file.
- In the Git Bash terminal run the following command to register your global ignore file:
git config --global core.excludesfile ~/.global_gitignore
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':
Or if you're using Eclipse ADT, just click the 'Android SDK' icon in the top toolbar:
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
If you're using Eclipse ADT, just click the 'Android Virtual Device Manager' icon in the top toolbar:
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.