IntelliJ IDEA 13 Brings a Full Bag of Goodies to Android Developers

At JetBrains we’re always listening to developers, and Android developers are no exception. Based on this tight feedback loop, we’ve made a long list of changes to our award-winning IDE which will hopefully make development of Android apps an even bigger pleasure. Here’s what IntelliJ IDEA 13 has to offer you.

Gradle-based build system
IntelliJ IDEA 13 offers first-class support for Gradle, with Gradle-based application now being a distinct type of project. This version is the first to incorporate new features coming from our collaboration with Google’s Android Studio. Developers have reported that IntelliJ IDEA’s higher level of support for Gradle is the biggest difference between the two IDEs.

To create a Gradle project, you go through a wizard similar to that of Android Studio. Among other things, you can choose the application icon and its default type of activity. IntelliJ IDEA 13 also makes Gradle files easily accessible, and provides full code assistance for editing them.

Smarter XML editor
Creating an Android application sometimes requires dealing with a lot of different XML files—layout, manifest, resources, settings, and more. IntelliJ IDEA already provides a nifty graphical editor for layout files, but what about others? According to the feedback we’ve been getting, the majority of Android developers still love to edit XML files manually. So we greatly improved the XML editor and made it smarter than ever!

In IntelliJ IDEA 13, the XML text editor offers the following new features.

User-defined XML attributes order. You can use the Settings dialog to define how attributes in your layout files should be arranged. After defining the rules, simply perform code formatting to apply them.
Automatic insertion of required attributes. IntelliJ IDEA can detect and add XML attributes required by document schema with just a single click.
Documentation popups for XML attributes. You can view documentation provided in XML schema for elements, attributes and types by just hovering your mouse over them in editor, as you type.
Line breaks. You can instruct IntelliJ IDEA to style your XML code so that line breaks are automatically inserted before the first and/or after the last attribute of an XML element. Note that you can apply different settings for manifest and layout files.

In Android, you have many XML files where you store color information: layouts, shapes, gradients, etc. IntelliJ IDEA now offers built-in color pickers that let you insert a color value anywhere by just clicking the corresponding gutter icon, which is context-sensitive and intelligently appears only when you may need it.

Navigating through a pair of related files
In Android applications, XML files and classes are often related. The classic example is a layout file (or fragment), and its associated activity; other examples are activities or services and the manifest file. IntelliJ IDEA helps tracking dependencies between any pair of XML and manifest, layout or fragment files, and provides navigation between them via gutter icons.

Also, you can navigate between related files by using Go to>Implementation context menu command.

IntelliJ IDEA 13 also brings you an easier way to browse Android SDK classes, with a significantly reduced amount of red code you encounter. Navigation to classes is also possible from platform XML files.

Easier component prototyping
IntelliJ IDEA makes development of Android components faster by letting you create new fragments directly from the menu, and, optionally, automatically generating basic layout files.

After you type the name of a view component in XML code, IntelliJ IDEA shows an icon in the completion list that you can click to automatically generate the appropriate XML code.

Android-specific code inspections
IntelliJ IDEA 13 brings many new Android-specific code inspections. For example, it can tell you when the onclick attribute of a layout element tries to reference a method that does not exist, and then offers a quick-fix to create a stub for such method.

Android-specific code analysis works together with many new Lint inspections.

Dedicated editing features for manifest files
You can enjoy all the power of default XML editor for manifest and other Android application files, plus these features provided specifically for them.

Completion for SDK versions in manifest. When you specify the minimum and maximum SDK that the application may support, IntelliJ IDEA provides code completion to help choose the API version.

Line breaks. You can tell IntelliJ IDEA to insert line breaks before the first, and/or after the last attribute of an XML element. This setting is independent from its twin which affects layout files.

Class-manifest cross navigation. When you edit a Java class, you can jump to the corresponding location in the manifest file via a gutter icon. If a class uses another class defined in manifest, you can also jump to its declaration. Documentation from XML schema is also available in the manifest editor.

Redesigned Logcat UI
IntelliJ IDEA provides a nice user interface around the logcat command, which lets you view and filter content generated by the Android logging system. In the latest version, this has been improved with tabbed layout and one-click navigation to specific process output. Plus, you can capture screenshots directly from the IDE.

Also, you can create and apply filters to the logcat view based on a number of parameters, e.g. contained text, tag, package name or process ID. Note that for tags and text, you can specify regular expressions along with literal values.

Finally, you can disable logcat for application start, and run it to clear the log before launch.

Multi-device preview
IntelliJ IDEA UI designer allows you to build application UI by dragging widgets from its side palette. In version 13 you can simultaneously preview the UI you’re creating on multiple devices, by just selecting Preview All Screen Sizes from the device drop-down. Preview displays all changes made through the UI designer or XML editor in real time.

Access SQLite Databases right from the IDE
This is one of the most requested features that lets you connect to device database and explore its contents directly from the Database tool window by selecting the Android SQLite entry. You have the complete range of database tools at your disposal: table editor, query editor, and diagram builder.

SQLite support is not available on Android versions prior to 2.2. It works on both rooted and non-rooted devices. In IntelliJ IDEA, SQLite support is only available in the Ultimate Edition, because it relies on the Database Support plugin.

Built-in 9-patch Editor
IntelliJ IDEA 13 comes with built-in editor that supports 9-patch graphics. To use it, just create files .9.png extension in one of the drawable folders, and then double-click them.

And the list doesn’t end there
Of course, IntelliJ IDEA 13 brings Android developers more than can be described in a single article. For example, IntelliJ IDEA 13 gives you a new type of folder in addition to Sources Root, Resources Root and test roots: Generated folder, where you place system-generated source files. These folders offer read-only access, and are not available as a refactoring target.

With IntelliJ IDEA you can deploy a previously defined custom Android artifact via the Edit Configurations dialog.

Another small but useful feature lets you automatically extract string literals into resource files from layout and manifest files.

Not to mention that writing Android applications has a lot to do with Java, and IntelliJ IDEA 13, being an award-winning Java IDE, brings Android developers its powerful Java editor, navigation, inspections, refactorings, and many other features.

To download your copy of IntelliJ IDEA 13, visit http://www.jetbrains.com/idea.

image description