Search This Blog

24 August 2011

IntelliJ IDEA and the Android Source tree

It can be quite annoying to develop in the Android source tree if you don't have your IDE properly configured.  I thought I'd share a few notes from my testing IDEA with the repo sync'd tree...

  • When initially making your project, make sure it is a fresh checkout or do a 'make clean'.  Otherwise, all the *_intermediates turn into separate modules.

  • When it auto-detects the Android Facets, uncheck them all. If the Android Facet is setup, you will resolve classes to android-x.jar instead of your module source.
    • It can also auto-generate gen/ directories which cause duplicate R.java clases during builds if the Android Facet is chosen.

  • Since we are not using the Android Facets, the R.java files become a problem.  To correct this, create a new module (and make it a dependency of any module needing the resolution):
Content Root: out/target/common/R
Module File Location: anywhere BUT out/*
  • You probably are not going to be working on every single module unless you work with Cyanogen.  Right click on a module and add it to your favorites.  In the top of the dock, click the pull down and choose to view your favorites.

  • Build from the command line.  You might be able to do it from within the IDE, but I haven't tried that.

Thank you to the JetBrains support team; and a special thanks to Serge Baranov who put up with me long enough to get some of these issues resolved.