title: Dependency on .aar cannot be resolved in higher level modules
body: <p>I'm using a certain SDK that comes in a couple of .aar files. Their instructions for importing it in my project are, in short:</p>
  
  <ul>
  <li><p>put the .aar files in a "libs" folder inside your module</p></li>
  <li><p>add to the build.gradle (for each of the aar files):</p>
  
  <pre><code>compile(name: 'xxx-release', ext: 'aar')
  </code></pre></li>
  <li><p>add to the build.gradle:</p>
  
  <pre><code>repositories {
    flatDir {
      dirs 'libs'
    }
  }
  </code></pre></li>
  <li><p>clean project, sync gradle</p></li>
  </ul>
  
  <p>This works in a simple project, but not in mine. My project is build from multiple modules: </p>
  
  <pre><code>  project
      mainModule1
      mainModule2
      mainModule3
      sharedModule1
        libs/xxx-release.aar
        libs/x.aar
      sharedModuleX
  </code></pre>
  
  <p>I have three main modules that are used for different variants of the app. These three modules depend on a number of other modules. Those (sub) modules are shared between the main ones and contain various app features. We put a lot of effort in making the app as modularized as possibe. Inside one of these shared (sub) modules there is a libs folder where I have added the aar files. The build.gradle of that module (sharedModule1) contains the "dependencies" and "repositories" blocks.</p>
  
  <p>Only that module will ever use those aar dependencies, so I prefer to keep them inside the module. Furthermore, the vendor of the aar's SDK recommends the same. </p>
  
  <p>The sharedModule1's dependencies work, Gradle does not complain about it.
  However, I get errors on the main modules. Apparently they also depend on the aars but the dependencies cannot be resolved.</p>
  
  <p>The errors look like, for each main module:</p>
  
  <pre><code>    .../MainModule1/build.gradle
      Failed to resolve: :xxx-release
      Failed to resolve: :etc-release
  </code></pre>
  
  <p>How do I get those dependencies to work? The aars should be available both in their sub-module, and in the main modules.</p>