IntelliJ and Android Gradle dependencies - unable to find module
android, android-studio, gradle, intellij-idea, java
Solution
I was able to solve this by deleting the settings.gradle file from every Gradle project that I wanted to use as dependency (clearing the contents of this file was not enough).
NOTE: As I have little knowledge of Gradle and Android Studio, I cannot provide information about why the presence of this file does not allow Android Studio to include the Gradle project as a module.
Problem
I have following directory structure: ``` D:\PROJECT +---javaGradleProject1 +---javaGradleProject2 +---javaGradleProject3 \---AndroidProject | build.gradle | settings.gradle \---AndroidModule build.gradle ``` Android module depends on all of java gradle projects that are at the same level in root directory as AndroidProject. In AndroidProject/settings.gradle I have: ``` include ':AndroidModule' include 'javaGradleProject1' project(':javaGradleProject1').projectDir = new File(rootDir, '../javaGradleProject1') include 'javaGradleProject2' project(':javaGradleProject2').projectDir = new File(rootDir, '../javaGradleProject2') include 'javaGradleProject2' project(':javaGradleProject2').projectDir = new File(rootDir, '../javaGradleProject2') ``` And then in AndroidProject/AndroidModule/build.gradle I have dependencies set like this: ``` compile project(':javaGradleProject1') compile project(':javaGradleProject2') compile project(':javaGradleProject3') ``` This structure of dependency perfectly works and project builds when I invoke ``` gradle build ``` on AndroidProject/build.gradle. But when I try to synchronize my IntelliJ with current gradle dependency settings I receive ``` Error: Unable to find module with Gradle path ':javaGradleProject1' Error: Unable to find module with Gradle path ':javaGradleProject2' Error: Unable to find module with Gradle path ':javaGradleProject3' ``` and because of that my project cannot be run from Run Configurations (it does not compile at all in IDE). I was trying to add these dependencies manually by hitting F4 and module dependencies but after synchronization all of my changes are overwritten (actually, IntelliJ just removes it). Is there anything wrong in my gradle structure? I have tested it on IntelliJ IDEA 14.1.4 and Android Studio 1.3.