Overview of the Android StudioMar 20, 2014

About This Document

From a developer’s perspective, migration from one Integrated Development Environment (IDE) to another can be difficult. The Android Studio had an early access preview on 2013 and is expected to be more stable by 2014. A summary of guidelines on how to work in this IDE will be helpful should developers decide to shift IDEs in the future.

1. Introduction

1.1. A New Integrated Development Environment

Android Studio is an integrated development environment (IDE) released by Google during the Google I/O developers’ event last May 2013. This brand new IDE is made exclusively for Android development and is intended to be an alternative support for application creation. The most recent release, version 0.4.2, is capable of supporting designing, testing, and debugging, although several features are still incomplete or not yet implemented since it is in early access preview.

1.2. How to Get Started
1.2.1. Java Development Kit and Java Runtime Environment

To develop using Android Studio, the Java Development Kit (JDK) and Java Runtime Environment (JRE) have to be installed. Guidelines on the installation can be found in the Oracle
Documentation site : http://docs.oracle.com/javase/7/docs/webnotes/install/index.html.

1.2.2. Android Studio

Android Studio is available for three platforms – Windows OS, Mac OS X, and Linux. The procedures for the installation as well as the latest IDE package can be downloaded from http://developer.android.com/sdk/installing/studio.html.

2. Working with Android Studio

2.1. Android Studio Components

Android Studio was based on the Java IDE called IntelliJ IDEA; hence, IntelliJ IDEA’s Android Plug-in and Android Studio are built from the same code. Migration from Eclipse to Android Studio requires getting accustomed to the differences in terminologies, file structure, interface, and developer tools.

2.1.1. Terminology

Changes in the terminology between the Eclipse and Android Studio interface are shown in Table 1.

Differences in terminology between Eclipse and Android Studio
Eclipse Android Studio
Workspace/Project Project
Project Module
Run Configuration Run Configuration
Library Module Library
2.1.2. Interface

The IntelliJ interface is similar with the Android Studio interface. However, it is different from the Eclipse interface as shown in [Image 1], [Image 2], and [Image 3].

[Image 1] IntelliJ IDEA user interface [Image 1] IntelliJ IDEA user interface
[Image 2] Android Studio user interface [Image 2] Android Studio user interface
[Image 3] Eclipse user interface [Image 3] Eclipse user interface
2.1.3. Panels and Toolbars

Changes in the panels and toolbars are shown in the [Image 4]. Table 2 discusses each component.

[Image 4] Android Studio user interface components [Image 4] Android Studio user interface components
Android Studio user interface components
No Component Description
1 Menu commands and options to customize the workspace
2 Default Toolbar contains tools that provide access to the AVD, SDK manager, and define actions
3 Project Path displays the project’s file hierarchy
4 Project Panel shows a tree view structure of the project, enables the user to perform various actions such as select, open, and edit
5 File Editor allows users to write and edit codes
6 Preview Pane preserves a preview of sample devices with respect to the design created in the project scripts and code
7 Android Status Bar shows status updates while processes are running in the background
2.1.4. Project Explorer

As shown in [Image 5], the project structure is different for Android Studio since by default it supplies the .idea folder which stores specific metadata by Android Studio, a gradle which serves as a build system’s jar wrapper that is able to communicate with the OS or other platforms or libraries, and lastly, a project module which contains files similar to the usual supplied by Eclipse such as the src, gen, and res folders.

[Image 5] Comparison on the project structure in Eclipse (left) and Android Studio (right) [Image 5] Comparison on the project structure in Eclipse (left) and Android Studio (right)

The Project Explorer can be customized according to the developer’s needs using the project coping feature of Android Studio. Using this feature, color coding can be applied to related files. It can also be assigned if there are further intricacies in delegating the project files. As shown in [Image 6], the block of related folders and files has been assigned the color orange. This is useful if developers have libraries or classes to flag during development.

[Image 6] Sample of color coded classes and XML files [Image 6] Sample of color coded classes and XML files
2.1.5. Code Editor and Form Designer

Due to the Live Layout feature of Android Studio as shown in [Image 7] and [Image 8], there is a dynamic change in the user interface (UI) as the XML scripts are revised. Android Studio not only allows developers a preview of the UI but also supports a Presentation View which can be accessed through the View option in the Menu toolbar. This provides developers the convenience of toggling between the codes and the UI preview.

[Image 7] Preview of workspace allocation [Image 7] Preview of workspace allocation
[Image 8] Presentation view [Image 8] Presentation view
2.1.6. Launching an Application

The emulator of Android Studio is similar with that of Eclipse as shown in [Image 9]. Creation and launching of an emulator requires the same procedures making a device in the AVD Manager and clicking the launch button. Android Studio provides optional debugging tools incorporated such as in-place refactoring, spot tests, pull members up, and other features supported by IntelliJ.

[Image 9] Android Debug Monitor [Image 9] Android Debug Monitor

3. New Features Available

3.1. Gradle-based Build Support

Aside from the usual project configuration made through an XML file, gradle is a project automation tool integrated with Android Studio that helps developers organize, manage and incrementally build their application.

As shown in [Image 10], the typical contents of a gradle file contain the repositories and dependencies needed by the program. This feature is also useful for multi-project and library support as well as project testing.

[Image 10] Sample gradle file [Image 10] Sample gradle file
3.2. Smart Editing

Android Studio offers an improved intellisense feature, also known as code completion. Android Studio has added annotation as a basis for the suggested variables and methods during code completion. This allows the IDE to determine which values or lines in the code can cause an error. The intellisense then gives a warning as well as hints on how to resolve it. An enhancement to work with the intellisense is Android Studio’s deep code analysis which enables android specific refactoring. Since Android Studio is an IDE made solely for Android, it has a context-aware system for API compatibilities.

Android Studio has a code folding feature to maintain code cleanliness. It allows the developer to have simpler view of the code. Using this feature, the code may appear as hard-coded strings as shown in [Image 11] and [Image 12].

[Image 11] Example of code folding feature [Image 11] Example of code folding feature
[Image 12] Example of code folding feature [Image 12] Example of code folding feature

Code folding is not limited to strings. It is also applicable to icons, classes, and other components. Android Studio provides a quick help feature called Open Symbol. This can be accessed through the Help option in the Menu toolbar or through the shortcut keys provide. As shown in [Image 13], Open Symbol is an easy access tool to find methods through unfamiliar APIs or libraries. It can also be used to locate custom actions or windows.

[Image 13] Open Symbol feature [Image 13] Open Symbol feature
3.3. Live Layout

Like in Eclipse, Android Studio has a drag and drop UI component as shown in [Image 14]. Android Studio supports preview of multiple screen size configurations as well as toggle the view across translations and color options. Android Studio allows designers and developers real time application rendering. Thus, the preview is synchronized with the revisions done in the file editor.

[Image 14] Example of synchronization between the file editor and the preview [Image 14] Example of synchronization between the file editor and the preview

4. Android Studio and Eclipse : Comparison

Android Studio vs Eclipse
Category/Feature Android Studio Eclipse
Build based on the IntelliJ platform; thus, IntelliJ plug-in and Android Studio are built from the same code serves as an ADT plug-in, though Google provides an IDE bundled with it
Installation requires frequent updates stable does not require frequent update
Cost FREE FREE
Project structure contains a .idea folder, gradle files, and other folders like src, gen, res generated by Eclipse contains src, gen, and res folders by default
Dependency declaration dependencies are declared in both gradle and XML files dependencies are declared only in the XML file
Terminologies Examples:
Android Studio Term = Eclipse Term
Workspace/Projects = Project
Project = Module
Visual editor live Layout offers a preview of the layout but is not rendered at real time
View provides Drag and Drop UI Layout Editor, Presentation View, and Live Layout provides Drag and Drop UI Layout Editor
File editor uses annotated-based intellisense in addition to the default code completion options supports Java-based code completion
Testing AVDs are compatible
Debugging offers support for Lint Tools, Ant Tools, Thread Monitoring, Groovy, Gradle, and more offers support for Lint Tools, Ant Tools, Thread Monitoring, and more
Table 3 Android Studio vs Eclipse

5. Conclusion

Android Studio is an IntelliJ-based platform that offers better UI for designing and coding. It has ProGuard and app-signing capabilities, as well as gradle-based support. The Live Layout feature allows the developer to view the user interface as the codes are written and modified. It also has the Presentation View aside from the Drag and Drop UI layout editor. An improved intellisense feature through added annotation is also available. Still in its initial release, the future versions are geared towards a more efficient handling of multiple projects.