Chủ Nhật, 10 tháng 8, 2014

Introducing Android Studio – Google’s IDE of the future for Android development

There is a new IDE on the horizon for Android developers, and rumors say it’s faster and easier to navigate than the current Eclipse-based Android Developer Tools plugin. In this article, I’ll introduce you to Android Studio, Google’s IDE of the future for Android app development.
Google’s Android Studio is a development tool for Android applications based on the IntelliJ IDEA platform, one that managed to attract a lot of hype when it rolled out in mid-2013. IntelliJ IDEA on the other hand in case you’re not so familiar with it, is a leading IDE for Java Development from a company called JetBrains. IntelliJ IDEA has been around for a long time now. Since the native code for Android development is Java, you can tell that IntelliJ IDEA is primarily used for Android app development.
That said, this article is not about IntelliJ IDEA but rather on Android Studio, the new IDE by Google for Android development. Roughly a year later, the platform is still in ‘early access preview,’ and work on it is ongoing. Eclipse, on the other hand, is the granddaddy of IDEs; although it doesn’t offer native Android support, it does have some nice tools to help you build Android applications—one such tool is the Google Plugin for Eclipse, made by Google.
In otherwords, before now and still currently in use for Android App development is the ADT(Android Development Tools) which is based on Eclipse. Personally, I still use Eclipse, especially in signing, proguarding and packaging apps. When I typically don’t use Eclipse is in times when I’m working on a game app, then I switch to GameSalad or if I’m building a cross-platform mobile web app using the PhoneGap framework in which case I use Dreamweaver and Aptana Studio. Setting up and using Dreamweaver with PhoneGap for Android development would be an article for another time.

Now back to Android Studio

Like I said earlier, Android Studio is a new Android development environment based on IntelliJ IDEA. It provides new features and improvements over Eclipse ADT. It is still in its beta version and will be the official Android IDE once it’s ready. On top of the capabilities you expect from IntelliJ, Android Studio offers:
  • Flexible Gradle-based build system.
  • Build variants and multiple APK generation.
  • Expanded template support for Google Services and various device types.
  • Rich layout editor with support for theme editing.
  • Lint tools to catch performance, usability, version compatibility, and other problems.
  • ProGuard and app-signing capabilities.
  • Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine.

Word of Caution:

Android Studio is currently in beta. Some features are not yet implemented and you may encounter bugs. If you are not comfortable using an unfinished product, you may want to instead download (or continue to use) Eclipse with ADT.
Now, lets review some of the features of this IDE and see why you may want to use it, in contrast to the already existing Eclipse ADT

Drag and Drop Gui Designer

One supposedly great feature of Android Studio is its layout designer with a drag-and-drop interface. But the reality is, unless you’re a Visual Basic aficionado who’s spent years drawing out sophisticated 3D interfaces with chiseled buttons and can’t quite break the habit, the amount of time you’re going to spend on drawing out the interface is minimal. Yes, you want a good, usable interface—but if you’re writing a serious application for serious work, most of your time will be spent on code, not tweaking visuals.
Verdict: Draw

Code Completion

The more time you spend as a programmer grinding out code, the more you appreciate code completion. For me personally, the most important part is when the IDE tells me the member names of an object. In general, I found that the code completion is better on Android Studio than Eclipse, which seems to get a little confused at times and doesn’t always give accurate results.
Verdict: Android Studio (by a hair)

Gradle Integration

Android Studio uses the Gradle set of build tools; in fact, it’s so integrated, it’s next-to-impossible to use a different tool. In other words, you’re stuck: if you’re moving from Eclipse to Android Studio, and not already using Gradle in Eclipse (which offers decent support via plugins), you’re going to have to switch.
That said, Gradle is a really great tool, and if you do make the decision to go with Eclipse, I nevertheless encourage you to look at Gradle’s features, try it out, and see if it fits with your project. And if you want to go with Android Studio, don’t despair about being stuck with Gradle; it’s quite good.
Verdict: Android Studio

User Interface

Eclipse is big, and perhaps a bit cumbersome. I’ve been using Eclipse since it first became popular a decade ago, so I know my way pretty well around its interface and quirks. (I do remember being a bit overwhelmed at first, but let’s face it: most IDEs are overwhelming when you first start using them.) With that in mind, I find that the menu items and tools in Android Studio tend to get me where I need to be a bit more quickly and easily compared to their counterparts in Eclipse, even with the Android plugin.
That being said, there’s another aspect to the interface: Android Studio was built specifically for Android, while Eclipse was built to be a general all-purpose IDE that can be used with any platform and any language (although Java is clearly the main focus).
Verdict: Android Studio

Workspaces and Projects

One thing that I’ve always felt is a bit unnatural in Eclipse is the way it deals with workspaces. When you want to work on multiple projects in Eclipse, you combine them into a workspace. In order to switch to a different workspace, you select the path, and then Eclipse restarts. That always seemed awkward to me. If you want to copy projects between the workspaces, things can quickly turn into a mess—yes, there are proper ways to do it, but it’s very easy to screw up.
I’m not particularly fond of Microsoft Visual Studio, but I’ve used it in recent years more than any other IDE (due to paying customers needing work in it), and I will say that managing projects and workspaces (called solutions) in Visual Studio is far easier than they are in Eclipse, in my humble opinion.
As for Android Studio, you still have the equivalent to Eclipse’s workspaces and Visual Studio’s solutions. With Android Studio, everything is encapsulated into a project. (So in this sense, a project in Android Studio is more like a workspace in Eclipse.) Within your project you have modules; your main set of code, such as the app you’re building, will likely be one module. If you have a library, that will be another module. But other things qualify as a module as well, such as build scripts. To me, this makes a good bit more sense and seems much more natural to me. (Also, for what it’s worth, this is a concept Android Studio inherited from IntelliJ IDEA.)
Verdict: Android Studio

Conclusion

If you’re using Eclipse, I encourage you to try out Android Studio for a few days and see how it works for your project. If it fits the bill, then go ahead and switch. This is true especially if you’re relying on the Google plugin for Eclipse or the Eclipse ADT, as Google seems to have more focus on Android Studio, and either way you’re tied to Google.
Should you switch from Eclipse to Android Studio? I say try it. Use it, see what you think, and make your decision; I suspect you’ll like it. If you’re already using Eclipse, try out Android Studio and, if you like it, decide how easily you can switch over to it. You can accomplish the same things with either tool—it’s more a question of ease-of-use.

Android studio can be downloaded here

Here are a couple of screenshots from the program:

Không có nhận xét nào:

Đăng nhận xét