title: Adding external JAR file in Gradle project on Android Studio
body: <p>I'm having a terrible time adding an external JAR to my gradle project in Android Studio. I asked a similar question <a href="https://stackoverflow.com/questions/21046095/how-can-i-add-a-jar-in-my-gradle-project">here</a> but those answers haven't worked for me. </p>
  
  <p>I created a <code>libs</code> folder and added my JAR in there: </p>
  
  <pre><code>~/android/MyProject/libs $ pwd
  /Users/me/android/MyProject/libs
  ~/android/MyProject/libs $ ls
  TestFlightLib.jar
  </code></pre>
  
  <p>And I added the following in my <code>build.gradle</code></p>
  
  <pre><code>dependencies {
      compile fileTree(dir: 'libs', include: '*.jar')
  }
  </code></pre>
  
  <p>After doing all this I clicked <code>Build -&gt; Rebuild</code> project but that still doesn't let me add <code>import com.testflightapp.lib.TestFlight</code></p>
  
  <p>I also tried the second solution of right clicking <code>TestFlightLib.jar</code> and adding it as a Module. This lets me add <code>import com.testflightapp.lib.TestFlight</code> successfully but when I <code>Run</code> the project I still get the error: <code>Gradle: error: package com.testflightapp.lib does not exist</code></p>
  
  <p>What am I doing wrong? </p>
  
  <p>How can I simply add an external JAR to my gradle project?</p>