title: How to share a single library source across multiple projects
body: <p>Question as in title. A similar question was asked <a href="https://stackoverflow.com/questions/21592647/android-studio-external-library-projects">here</a>, and the only workaround that time was to publish the project into a local Maven repository.</p>
  
  <p>Is this problem fixed (as claimed by some) in Android Studio 0.5.+? In its <a href="http://tools.android.com/recent/androidstudio050released" rel="noreferrer">release note</a> there is a statement that says "Support for source folders outside the module content root". Does that mean we can finally import the library from outside the project folder?</p>
  
  <p>I tried File->Import Project.. but it doesn't work. </p>
  
  <p><strong>EDIT 2: See accepted answer for latest solution (as of 0.8.+)</strong></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My project directory structure has only one module <code>main</code> which looks like this</p>
  
  <pre><code>MyApp
      main
          build.gradle
          src
      build.gradle
      settings.gradle
  </code></pre>
  
  <p>The library project directory has only one module named like <code>lib</code> (they are all auto-generated when creating a new library project)</p>
  
  <pre><code>MyLibrary
      lib
          build.gradle
          src
      build.gradle
      settings.gradle
  </code></pre>
  
  <p>The following line is added into <code>MyApp/settings.gradle</code>:</p>
  
  <pre><code>include ':main', '..:MyLibrary'
  </code></pre>
  
  <p>The following is added into <code>MyApp/main/build.gradle</code>:</p>
  
  <pre><code>dependencies {
      compile project(':..:MyLibrary')
  }
  </code></pre>
  
  <p>The result is the following error:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring project ':main'.
  &gt; Configuration with name 'default' not found.
  </code></pre>
  
  <p>As a side note, the library project <code>MyLibrary</code> itself can compile without error. The problem seems to be <code>settings.gradle</code> not being able to recognize the library project structure.</p>