title: How to include .jar dependencies into final .aar library file? (Android Studio 1.5)
body: <p>I have Android Studio library project which has it's own Gradle dependencies:</p>
  
  <pre><code>dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
      compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
  }
  </code></pre>
  
  <p>The problem is with those two external libraries (retrofit &amp; converter-gson).
  Result of this library project is .aar file. But when I use this .aar file in a separate project I get unresolved class error:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit/Retrofit$Builder;
  </code></pre>
  
  <p>Is there a way to include those gradle dependencies from my library project into the final .aar file?</p>
  
  <p>I tried <a href="https://stackoverflow.com/questions/33445270/how-to-include-jar-dependency-into-an-aar-library?answertab=active#tab-top">this answer</a> but it didn't work for me.</p>
  
  <p><strong><em>EDIT:</em></strong>
  My whole build.gradle file from library project.</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.2"
  
      defaultConfig {
          minSdkVersion 15
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
      compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
  }
  </code></pre>
  
  <p><strong><em>EDIT 2:</em></strong>
  This is the part of the build.gradle script in my app project which uses the library which was generated before as an .aar file.</p>
  
  <p>3 versions and none of them work (none of them download automatically dependencies form the library)</p>
  
  <p>(note, I am adding this .aar file into the lib folder of my app project and adding the <em>flatDir</em> instruction into it's gradle.build). I am not doing <code>File-&gt;New-&gt;NewModule-&gt;ImportExistingJAR/AAR</code></p>
  
  <pre><code>repositories {
      flatDir {
          dirs 'libs'
      }
  }
  </code></pre>
  
  <p>1.</p>
  
  <pre><code>compile(name:'mylibrary-release', ext:'aar')
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>compile(name:'mylibrary-release', ext:'aar') {
      transitive = true
  }
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>compile(':mylibrary-release@aar') {
      transitive = true
  }
  </code></pre>