Android Studio – A Better IDE?
I’ve used tools from IntelliJ for years, however for Android I’ve always used Eclipse. When Google announced Android Studio, a collaboration between Google and IntelliJ makers JetBrains, I was pretty excited. My development needs are pretty simple, but I’ve always found developing in the Eclipse ADT bundle to be a bit clumsy, difficult to configure, and painfully slow. I already use PHPStorm (another JetBrains product), so is Android Studio – a better IDE compared to Eclipse? Let’s see.
Eclipse/ADT Bundle Thoughts
In general I think it would be unfair to say there is something “wrong” with Eclipse/ADT Bundle., but there are a lot of small things that eventually add up. I’m running these tools on my MacBook Pro: OS-X Maverick, 16GB RAM, and a 580GB SSD. Here’s the list of things that I see lacking in my current ADT Bundle IDE:
- Eclipse itself – although I have used Eclipse for years, it is still not an easy tool to configure, use, and keep up to date. This is particularly true if you try to use one install for many purposes. There are just too many collisions between configurations. So instead I general have 3 or 4 Eclipse installs with each for a specific kind of development.
- Performance: Just running the environment requires 500-600 MB of RAM. If you actually do anything this can balloon dramatically. Even when you do have enough RAM performance is still sluggish.
- Updates: PITA plain and simple. Great example – everything worked great last week…today when rendering a graphical layout I get: This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in. Simple to fix…but PITA. It always seems like there is a hassle. I have ADT…a check for updates fails…have to do it manually. WTF?
- Configuration of simulators and other things is a mess. Anyone that likes the array of dialogs and configurations for managing devices is crazy. I guess if you are used to configuring servlet engines like Tomcat and JBoss Android is a breeze, but get real – PITA again.
- GUI designer. Not too bad, but it could be better. The layout managers have always been flaky in Java. Android is pretty good and in some areas is actually better than XCode’s.
Initial Configuration and Use of Android Studio
A decent installer gets you going right away – I’m working with V0.37. Its a whopper install at 1.39GB in space on OS-X and that only includes one rev of the ADK-SDK. On the plus side, everything is installed and configured for you. If you are familiar with any IDE, creating a new project is trivial – File, New Project…and complete the wizard. Worked perfectly and I was able to compile and get the app running in simulator…almost.
The simulator did not seem to load up properly. I see now that one of my Eclipse issues will not be solved – Studio uses the same basic virtual device and SDK manager as the Eclipse tool does. Android Studio of course also installed its own version of this. It is possible to switch, but first let’s make sure that everything works.
I created a basic virtual machine and the app launched on it! Cool! I can see during both project creation and build that a heavy use of Gradle is happening. I don’t know too much about Gradle, but I certainly have a love-hate relationship with Maven so maybe I’ll have to dig into Gradle a bit more.
Like I said – its possible to use an existing ADK install that you have. Since the downloads are so large this makes a lot of sense. You can also then also use a set of virtual devices that you have already created and share these between the two tools. In Android Studio close any open projects. The Welcome dialog should appear on screen. Click configure in the right hand panel, then project defaults, then project structure, then you can set the SDK location.
If you then open your project and get a build failure it is probably because you are missing the Gradle dependencies in your SDK. To add them go to the SDK Manager and under the Extras add the Android Support Repository and Android Support Library. Here’s a stack overflow link if you need more.
Android Studio’s performance is excellent. Switching between screens, panels, and such is snappy. The GUI is also quite beautiful – who said Java desktop can be nice? This is proof absolute that it can be. While running Android Studio takes about 500-600MB of RAM – similar to Eclipse-ADT. The difference is that the UI is snappy.
Developing in Android Studio
I didn’t spend too much timing “doing” anything today, but really just poking around and exploring. I have to say that what Android Studio has done is take the best of the Eclipse-ADT, kept a familiar project creation and project navigation model and then added to this with a better set of GUI design capabilities/controls, really easy access to translation functions, a better build system, excellent git integration, and finally allows access to some of the best features from IntelliJ. Pretty darn impressive for v 0.37.
My favorite features of the designer interface is the quick ability to switch between device types, change the screen orientation, change the style set, and also to switch between various language translations. Very slick feature that will save tons of time since normally you would need to run the app in a simulator or on a device to test that kind of thing. Even XCode can do that (I don’t think). Translations can be added right from the GUI and there is a drop down to then switch back and forth so that you can see the impact of German vs. English on spacing. That’s really handy!
Android Studio also includes a full set of code refactoring tools that are hands down better than Eclipse. It also includes a set of code inspection tools, similar to Eclipse-ADT, but they are run when you want them to be and don’t generally interfere with builds. In Eclipse-ADT, Lint “errors” are build blockers and you have to keep clearing them out in order to complete builds. That can be good in some settings – like work – and annoying in others. Documentation generation tools (JavaDocs and Groovy) also work nicely.
Android IDE of the Future – Android Studio
Yeah – I think I will be using this tool quite a bit. I don’t work for JetBrains, but their tag line applies here – Android Studio does allow you to “develop with pleasure”. I’m not going to dump Eclipse-ADT completely, but I’ll be using Android Studio on projects as much as possible – along with the PHPStorm IDE since I do so much PHP coding. The two tools seem to play well together if you have them sharing the same Android SDK.
Upgrades work pretty well however I’ve found that projects need some manual actions to continue working right with gradle. What you will need to do is update a couple of files when you get a warning or error about gradle being out of date. The two files are build.gradle in your project’s App directory and the gradle-wrapper.properties file in App\gradle.
In the former you’ll need to update the dependencies and version number of gradle. From V0.37 to V0.40 of studio this went from 0.6.+ to 0.7.+
In the latter you’ll need to update the distributionURL. From studio V0.37 to V0.40 this changes from 1.7 to 1.9.
Rest of the update process seemed to work pretty well.