title: Android java module "jar" file dependency issue
body: <p>I have Android gradle project which consists of main module and a pure java library. The java library has a dependency on a jar file (Gson is shown here for demo purposes only):</p>
  
  <p><a href="https://i.stack.imgur.com/W4KRd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W4KRd.png" alt="tree structure"></a></p>
  
  <p>The project compiles fine but when I try to run it it fails with <code>NoClassDefFoundError</code>:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: com.google.gson.Gson
      at com.example.JavaLibClass.javaMethod(JavaLibClass.java:7)
      at com.denisk.deptest.MainActivity.onCreate(MainActivity.java:15)
      at android.app.Activity.performCreate(Activity.java:5135)
  </code></pre>
  
  <p>If I replace <code>jar</code> dependency with regular Maven dependency, it works.</p>
  
  <p>If I move <code>jar</code> dependency from <code>javalib</code> to <code>app</code> and introduce dependency <code>Gson</code> dependency in the activity, it works.</p>
  
  <p><strong>app/build.gradle</strong> dependencies:</p>
  
  <pre><code>dependencies {
      compile project(':javalib')
  }
  </code></pre>
  
  <p><strong>javalib/build.gradle</strong>:</p>
  
  <pre><code>apply plugin: 'java'
  
  dependencies {
      compile files('libs/gson-2.2.4.jar')
  }
  </code></pre>
  
  <p><strong>MainActivity</strong>'s <code>onCreate</code> (inside <code>app</code>):</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
  
      JavaLibClass javaLibClass = new JavaLibClass();
      javaLibClass.javaMethod();
  
  }
  </code></pre>
  
  <p><strong>JavaLibClass</strong> (inside <code>javalib</code>):</p>
  
  <pre><code>public class JavaLibClass {
      public void javaMethod() {
          Gson gson = new Gson();
      }
  }
  </code></pre>
  
  <p>Github repository with the demo project:</p>
  
  <p><a href="https://github.com/denisk20/android-gradle-dependency-test" rel="nofollow noreferrer">https://github.com/denisk20/android-gradle-dependency-test</a></p>
  
  <p>Am I doing something wrong or is it a bug?</p>
  
  <hr>
  
  <p>Edit 1:
  It doesn't matter whether I build with Android Studio or with pure Gradle.</p>
  
  <p>Edit 2:
  I have have tried it with android gradle plugin <code>1.4.0-beta4</code> from AOSP - same error.</p>