I have following directory structure:
D:\\PROJECT
+---javaGradleProject1
+---javaGradleProject2
+---javaGradleProject3
\\---AndroidProject
|
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.
Right click project, Select
"Configure Project Subset ..."
and select your module, rebuild your project.
In my case I had to change the external module name to lowercase only.
Add a colon (:) before the names of your modules when you add it in settings.gradle
, e.g. for the first one, change this:
include 'javaGradleProject1'
project(':javaGradleProject1').projectDir = new File(rootDir, '../javaGradleProject1')
to this:
include ':javaGradleProject1'
project(':javaGradleProject1').projectDir = new File(rootDir, '../javaGradleProject1')
Now in addition to compiling, IntelliJ / Android Studio should give you code completion.