Choosing an IDE for Android Development
In Chapter: Getting Started
Author: Ian Darwin ('idarwin')
You want to choose one IDE to use for your Android projects: Android Studio, Eclipse, or "other".
Weigh the pros and cons of each, then roll the dice. Try each one on a reasonable-sized project.
Whereas in the MS-Windows world there is a single IDE that dominates, and in the Android world where there is a single IDE that is "official", in the larger Java world there are several that are worth considering.
Eclipse was created by IBM in the early days of Java, once it was clear that their then-current IDE Visual Age was not going to live a long life (Visual Age was written in Smalltalk not in Java). In my experience teaching Java courses, about 80% of Java developers use Eclipse, and that figure has been fairly steady over the years.
Android Studio is the official Android IDE supported by Google. It is based on IntelliJ Idea, an IDE that has long been around, but was relatively marginal until Google incorporated their plug-in into it and renamed it Android Studio.
NetBeans was written by a small company that Sun Microsystems acquired. Sun Microsystems was in turn acquired by Oracle. Netbeans for a long time has been the "official" Java IDE, but its usage was "eclipsed" by Eclipse (remember: an eclipse occurs when another body passes in front of the Sun). Relatively few developers use NetBeans specifically for Android so, to keep the discussion focussed, NetBeans will not be covered in the rest of this recipe.
For the first decade of Android, Google recommended use of Eclipse with a plugin called "Android Development Tools" (ADT). They offered it both as a standalone plugin and in a bundle already integrated with Eclipse. Around 2013 they announced the switch to Android Studio based on IntelliJ. Shortly thereafter, the Eclipse Foundation announced that a small team was picking up ADT and merging in some additional tools. This package is called "AndMore". Eclipse with AndMore is equivalent to and forwards-compatible from Eclipse with ADT, though some names in the project files have to change.
The choice of project structure and accompanying build tool is also a factor in choosing. Eclipse supports a single level project, which is typically what you need for an application, with an optional second project for testing if you use the official Android unit testing framework (see Recipe XXX). ADT (thus AndMore) do not require an external build too; the plug-in contains all the smarts to build any type of Android application. It has only two project files that need to be kept under source control: .project and .classpath. A directory .settings can be controlled as well, but it changes a lot and is best ignored. There is even an API in Eclipse for manipulating project structure. Because there are only two files, hacking a project by editing configuration files is not out of the question. As well, Eclipse is well supported by the Maven build tool using the M2E (Maven Eclipse) nd and M2E-Android plug-ins (you want both). However, it must be admitted that this setup can be a little bit quirky.
Android Studio on the other hand uses a bewildering maze of project files. Here is a project created by Android Studio 2.0:
It appears to take Android Studio about 30 files what Eclipse does in two.
You should also consider the speed. Because Studio is not a complete IDE but depends on Gradle to build, it used to be a lot slower, but Studio 2.x is supposed to be much improved in this regard. Different people have different ideas on how to measure speed, and different results have been claimed, so you should try this yourself on representative development hardware.
What if you need both? You could use Eclipse in your regular Java work and IntelliJ/Android Studio for your Android work. You could even set up your Android projects to be openable in both IDEs - we've done so for most of the projects in the samples repository. However, it's not a very profitable undertaking, and we don't recommend it as a general practice.
As another path forward, you could use Android Studio but tell it to use the Eclipse key-mappings, which will make it work somewhat like Eclipse, although many of the key sequence settings here are just wrong. And, if you do so but another developer in your team is a "native" user of Studio, you will both get frustrated when doing pair programming.
If you want the best support of new features, Android Studio may be a better choice. If you want a widely-used IDE that is widely used across the Java community, Eclipse may be a better choice. There is no hard and fast answer.