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 clases during builds if the Android Facet is chosen.

  • Since we are not using the Android Facets, the 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.


  1. Oh yeah, on the step where it detects libraries... I unchecked android.jar*. We don't want it to ever resolve into those. I also unchecked all the swt.jar* that were not for my platform, but that is probably not necessary.

  2. Did you have any suggestions on what to do with .aidl files not working with the source? Seems to be a drawback of not being able to use android facets.

  3. AIDL should work fine if you are doing an Android app. It's just that the Android source tree doesn't really fit the requirements of an Android Facet (namely, which files it pulls its API from).

    Are you trying to edit AIDL in the Android source, or in your own app?

  4. Using the Android Source. I tried to symlink the aidl files to java of the same name, but that doesn't exactly solve the issue and ends up making more when you go to compile, lol.

  5. I do remember something about AIDLs autogenerating files which then conflicted. I think I disabled auto-compile because I was using Maven anyway.