Sunday, May 25, 2014

Android Studio vs Eclipse

In the last 6 months I have used Eclipse heavily to develop an Android app that made use of a RESTful API. After I finished that project, I started on my own personal project, using Android Studio (0.5.8 Canary). I've had about a week on Android Studio and have some thoughts on what each is like, if you're looking into picking one IDE and going with it for a project.

Eclipse

Eclipse is a full featured IDE that supports a lot of languages and forms the basis of many different IDEs. I've used Eclipse extensively through academic and non-academic times, and any programmer is bound to use it at some point, from Java to NIOS II.

As such, Eclipse is very heavy on memory usage (500MB for 1 open java file).  With Android ADT, it works fairly well with Android, compiling fast and providing nice features such as mouseover tooltips and quick fixes that Android Studio does not really have.

I've additionally used Eclipse on both my Macbook Air (10.9) as well as Windows 7 (and some Windows 8.1) and it seems fairly stable. Over the course of about 6 months it crashed maybe twice, which is fairly good for an IDE of it's size.

There are some drawbacks I have for Eclipse that I've noticed over the several years I've done Android Development.


  1. While developing with Eclipse is possible, it still feels like a plugin rather than an IDE for the job. It's easy to lose track of windows and items compared to Android Studio.
  2. As stated above, it uses much more memory than Android Studio.
  3. The XML editor has a strange bug on both Windows and Mac, where as you highlight things, text appears as if you were scrolled to a differnet position. Changing the cursor position does this as well and I cannot figure out why it does this, but it's seemingly random. It essentially forces you to restart the IDE as editing is impossible without breaking everything.
  4. The manifest editor, while handy, is way too big for even a 1080p monitor and is clunky.
  5. The XML editors cannot be copy pasted into - if you do, it will insert your text at the top of the XML document instead, which is confusing, as if you do not notice it, R will no longer compile, and you can spend hours trying to figure out what's wrong.
  6. Projects with multiple libraries in Eclipse sucks. My last project had about 5 or 6 libraries from source, and combined with Git for collaboration on the project, it was a nightmare and we constantly had to fix everyones setup. I've noticed on Android Studio it does it much better.
  7. Git support in Eclipse sucks. Period. Android Studio does it well, except on my mac is hangs on every single push and loses my commit as well.



Android Studio

Android Studio is a newcomer to the Android IDE scene, coming out in May 2013 at Google I/O. At the time of writing it is in a "preview state", not reaching beta. It is based on IntelliJ IDEA, which powers other IDE's like Pycharm.

In my experience using Android Studio, there are some great features as well as some serious drawbacks. The biggest strength I've found so far for Android Studio is the Gradle Build System, which is like a scripting language for building an application. As a small time developer I found it pretty overwhelming to use, so if you switch from Eclipse, be ready to sit down and learn how it works for a few hours.

Once you learn how Gradle works though, there are some nice things, such as using 2 lines in the build script to download and compile a library into your project via Maven. Eclipse was able to do this but it was very clunky didn't work well. It also lets you script how things are built, like using some resources for generating one APK and others for another. I haven't used these feautres as I don't have advanced apps like that, but it would be interesting to see them in use.

It also has better autocompletion than Eclipse most times, giving suggestions that make coding easier for the most part.

However, there are some serious drawbacks I hope are addressed.

  1. It uses Java 6 on Mac OS X, which is unacceptable in this day and age. Java 6 support ended a while ago, and I don't think installing a security risk on my machine is acceptable.
  2. Since I don't use Java 6 on my mac, I forced it to use Java 7 by editing the info.plist file in the app package. It breaks the update system which is annoying. The biggest issue is that it can use JDK 7 on Windows, but not on a Mac.
  3. On Mac OS X, it is absolutely unstable. I understand it's a preview and there are bound to be bugs, but I used the Windows version for several hours and had 0 issues. On my Mac? It's a freeze every 10 minutes. Change run configurations? Hang. Refactor? Hang. Git push? Hang, every single time. It wastes a ton of time. I'm seriously considering running Android Studio on my Windows 8.1 VM so it stops crashing, but I don't know if it'll run well with 3GB of RAM.
  4. "Quick Actions" are very annoying compared to Eclipse:
    1. In Eclipse, if something has a "quick fix", you mouse over the underlined item, and after a few milliseconds, several options appear, and you can click on one of them.
    2. In Android Studio, you put the cursor over an underlined item and then press Alt + Enter. This is good for keyboardists, but half of the time it doesn't open the menu and instead puts a line break, putting in more errors. I think it is due to a long delay of detecting where the cursor currently is, and it breaks the feature a lot.
  5. A final issue I have is that compiling projects with Gradle takes substantially longer than Eclipse - it takes about 20 seconds for a project of the same size compared to about 7 in Eclipse. This is significant as I test changes all the time, and that 13 seconds adds up to minutes if I test changes 50 times in a day.
  6. Android Studio has no GUI for XML files (except layouts) like the manifest. While the Eclipse one was clunky, it was nice because I didn't have to go to Stack Overflow every single time I needed to add a permission or change something in the manifest.

Verdict

Eh... I'd probably go with Android Studio. The gradle support is really nice, and developers are putting their libraries into Maven which makes it really nice to use libraries now. The crashing issues are really crippling, and hopefully will be fixed soon. I'm finally learning some of the keyboard shortcuts (though I don't like refactor). Eclipse feels clunky and can't be as focused on Android as it needs to be.

That said, Eclipes is still a fine IDE, and is wonderful for doing Java with.