IDEA 11 Android module problem

I'm working on a Android project that has some unusual business requirements and am having trouble after trying to upgrade to IDEA 11.  Because the main application is open source, I created a secondary library that for now is still closed source (if that changes, I can simple integrate the library into the application).  From a compilation perspective, the library is dependent on the application and is set up as such.  The manifest file for the main application includes declaration of the objects in the library.

In order to get the library objects to be resolvable and included during the build, I created a dependency in the application to the library (which is correctly flagged as circular).  This compiles and works fine in IDEA 10.5.  When I open the same project in IDEA 11, it fails to compile due to duplicate copies of the compiled resources (R.java) in the library even though it's just compiling the same resources (or am I missing something?).  Is it possible to suspend that check?  I also tried adding the output of the library directory as a library dependency, but that lead to some strange errors.  In the process, I tested every scope option that I could for the offending dependency as well as checking/unchecking the export box (and invalidated caches as I went) but haven't found a way to solve the issue.

So, is there any way to maintain this separation of the library from the main project using 11 and, if so, how?  

4 comments

Do you absolutely need the R.java in both modules?  If not, you could exclude the gen directory in your library project.  I did that before and it solved a compile problem I had.

0

I had previously tried removing the gen directory from the source folders based on some searches of the forums, but found the excluded button after reading your post.  Unfortunately, I tried excluding the gen directory from the library and got the same errors.  Oddly, when I went back in after compiling, the gen exclusion was gone and was listed as included again.  Wonder if it's a separate issue as per http://youtrack.jetbrains.com/issue/IDEA-79737 (to which I'll add my experience)?  Anyway, I excluded the subdirectories of the gen folder, invalidated the caches, rebuilt and those exclusions stuck and it solved the problem.  

Thanks so much for the suggestion!  

0

Unfortunately, 11.1.1 appears to have broken this workaround.  The build now fails due to the duplicate class in the cache files for the aapt compiler (/Users/justin/Library/Caches/IdeaIC11/compiler/[deleted]/.generated/aapt/[deleted]/R.java with [deleted] being the project name and library directories respectively).  Is there a way to ignore duplicates in the cache?  Can I take the cache out of play so that the gen directory exclude works?  Other suggestions?

0

Currently, we support cyclic dependencies between libraries, so you can try to extract a part of application code to a second library module.

0

Please sign in to leave a comment.