Issues with Android projects and composite builds

Answered

Hello everyone, first time posting on the forums here.  I've been dealing with some issues with a project structure I have setup for a little while now.  There's a simple workaround that I can apply, but I have to apply it every time the Gradle auto-import fires.  I'm not sure if this is a bug or if I'm using the Android plugin incorrectly (though if I have to change up my project structure then it would seem like the Android plugin makes assumptions it shouldn't and is, consequently a bug :P ).

Anyways, the zip file is linked at the end of the post.  Each folder within contains an example of my project setup with one exception: one folder has an android module and the other doesn't.

To summarize the issue in short: it appears that an Android sub-project breaks Composite builds.  My gradle hierarchy is as follows:

* Root Project
-- Composite Build Module
-- ModuleA (depends on Composite Build Module)
-- ModuleB (depends on ModuleA)
-- Android (depends on ModuleA)

The Android module breaks the composite build resulting in IntelliJ not assigning the correct dependencies for ModuleA and ModuleB (and probably the Android module as well).  My workaround is to, every time gradle syncs, edit the module settings for ModuleA and ModuleB to include a dependency on the Composite Build Module.  Because I use Auto-Import, every time gradle syncs I have to re-add those dependencies.

Is there a way to fix this?  I'd like my Android module to remain a sub-project and not the main project (since it isn't..)

Zip File: https://drive.google.com/open?id=1eLJ287nhUXM8PtL-47XAtVFHIS4ZTqzl 

0
1 comment

Thank you for the example project. this is a bug. Created the issue here: https://youtrack.jetbrains.com/issue/IDEA-205023

Unfortunaely currently if project has at least one Android module you can not use Settings(Preferences) | Build, Execution, Deployment | Build Tools | Gradle | Create separate module per source set option which is required for this project.

0

Please sign in to leave a comment.