Posts Tagged ‘android’

IntelliJ IDEA 10: free IDE for Android development

Tuesday, October 19th, 2010

Yes, you’ve read it correctly. No mistake here.

It’s been one year since we open-sourced IntelliJ IDEA and announced its free Community Edition. If you are curious to know the results of that bold move and see some stats and charts — check out this article on DZone.

Today, one year later, IntelliJ IDEA Community Edition gets a big addition: Android development plugin becomes available in the free edition of IntelliJ IDEA starting with version 10.

Please note we’re NOT open-sourcing something we don’t want to develop ourselves. In addition to improvements to existing IntelliJ IDEA features for Android developers, we will add the following new ones in version 10:

Prooflinks:

P.S. Those of us using Android phones truly hope that this will come back in the form of more great apps for our mobile devices! :)

Develop with pleasure!
-The IntelliJ IDEA Team

Android Library Projects Support

Thursday, September 16th, 2010

An Android library project is a development project that holds shared Android source code and resources. Other Android application projects can reference the library project and, at build time, include its compiled sources in their .apk files. IntelliJ IDEA X supports library projects natively as separate Android library modules.

To create a new library module you need to choose a platform and specify a package:

Application module has to depend on library modules to refer to their resources and source code. Scope of this dependency should be Compile. You can refer to library resources from your application module, as they are located in the same module. Note that you can change a module type (Application or Library) in Android facet settings:

Android unit-testing support

Wednesday, September 15th, 2010

With IntelliJ IDEA X you can write unit tests for your Android application using Android Testing Framework. Android unit tests are located in a separate test module, so first you need to add it (i.e. named tests) to your project, which must already contain an Android module (or module with Android facet) (i.e. named MyAndroidApp). Then, specify this tested module:

IntelliJ IDEA will automatically create a sample test class for your main activity (i.e. MyActivityTest). It’s handy that you can launch tests directly from editor. Note that it is important to choose an item with Android-specific icon for launching tests by Android Tests run configuration rather than using a default JUnit configuration:

Also, after adding a test module to project, IntelliJ IDEA automatically creates run configuration for launching all tests in module:

Note, that scope of a dependency between Test module and Application module should be Provided.

Android Logcat Support in Maia

Friday, September 4th, 2009

In Maia you can find a new Android Logcat window that lets you see all log messages and exceptions when you are debugging an Android application.

The Logging level list allows you to select what messages are displayed in console:

  • Verbose — lowest priority, all messages
  • Debug
  • Info
  • Warning
  • Error
  • Fatal
  • Assert — highest priority, assertions only.

Logcat supports stack trace navigation and messages highlighting (you can customize colors for various log levels in the IDE Settings dialog (Ctrl+Alt+S). Note that Logcat is available only in debug mode.

Android Resource Management Features

Friday, September 4th, 2009

Maia provides a number of smart features to make working with Android resources simpler.

  • Convenient navigation from XML resource descriptors to appropriate Java fields in an R.java class…

    … and from Java code to resource files.

  • Usage search for resources. That is, when you are searching for usages of res/drawable/android.png resource file you will find both XML (@drawable/android) and Java references (R.drawable.android). By the way, searching for usages of R.drawable.android Java field yields the same results.

    Note that you can find usages of value resources (represented by XML tags) by pressing Shift+F6 when caret is positioned just before a tag:

  • Rename refactoring. When you rename a resource file (i.e. res/drawable/android.png), all XML and Java references are updated automatically. Renaming of R.drawable.android Java field, as you may have guessed, has the same effect. Note that now renaming of a resource represented by an XML descriptor is possible only through renaming an appropriate Java field.

Code Completion in Android XML Files

Thursday, August 27th, 2009

Maia provides code completion for AndroidManifest.xml and other XML resource files:

  • AndroidManifest.xml file:

  • Other XML resource files:

  • For any Android XML file you also get completion of references to local and system resources:

Developing Android Applications in Maia

Wednesday, August 26th, 2009

Maia supports development of applications for Android operating system. To begin creating an Android application, open the File menu, click New Project, click Next, and then select Android Module type:

Now you need to create Android SDK — just specify its location folder and build target. IntelliJ IDEA will create a new global library for it (to which you can later attach sources or javadoc for better coding assistance).

For that you can either click View Classpath in the Android Facet configuration (which is automatically added to your module) or edit it just as any other library. Note that Android sources and javadoc are added automatically if they are located in default locations: <sdk dir>/src and <target dir>/src for source code and <sdk dir>/docs/reference and <target dir>/docs/reference for javadoc.

You can create Activities, Services, Broadcast Receivers and Remote Interfaces (AIDL files) from popup menu (Alt+Insert). IntelliJ IDEA automatically registers them in an AndroidManifest.xml file and provides syntax highlighting for AIDL code.

To create a new Android Resource, select the res folder (or any of its specific child folders) and press Alt+Insert:

To launch an Android application you can either use an Android run configuration (created automatically when Create ‘Hello, World!’ project option is selected in Android Facet settings), or just press Ctrl+Shift+F10:

You can use external JARs in your application by just adding dependencies via Project Structure dialog, Ctrl+Shift+Alt+S. Java module dependencies can be added in a similar way.