title: Proper way to add global library in android-studio/gradle
body: <p>First of all, I know how to add a <strong>local</strong> library to the <code>build.gradle</code> file, it was discussed in several questions here already (which are all basically the same), see <a href="https://stackoverflow.com/questions/16593391/android-studio-and-using-external-library-projects">here</a>, <a href="https://stackoverflow.com/questions/16779959/android-studio-importing-external-library-jar">here</a> and <a href="https://stackoverflow.com/questions/16614177/how-to-add-parse-to-an-android-studio-project">here</a>. But you have to hardcode the paths in the <code>compile files('/path/to/lib.jar')</code> statements in the <code>build.gradle</code> file, which isn't nice, not redistributable, etc, IF you use a library not within the project's folder structure. I prefer to maintain this library for all my projects in the same place (so it is always up to date for all projects etc.). So I would like to know how to add a library, which is not available via Maven, to an Android-Studio project using gradle, in a sane way, given that the library is added as a global library in AS's preferences.</p>
  
  <p>What I have done so far:</p>
  
  <p>I use Google's new Android-Studio, which uses gradle for the build management, to build an <a href="http://forum.xda-developers.com/showthread.php?t=1574401" rel="nofollow noreferrer">Xposed framework module</a>. For that, I have to include an external library, <code>XposedLibrary</code>, which I downloaded from the respective <a href="https://github.com/rovo89/XposedMods" rel="nofollow noreferrer">Github repository</a> to keep it up-to-date.</p>
  
  <p>It contains the jar <code>XposedLibrary/XposedBridgeApi.jar</code>, which I added in AS as a <em>global library</em> (Ctrl+Shift+Alt+S -> Global Libraries -> green plus to add the folder <code>XposedLibrary</code>). The compilation failed, complaining that it doesn't know the imported classes. So I had to manually add the library to the <code>build.gradle</code> file, adding the respective line in the dependencies like so:</p>
  
  <pre><code>dependencies {
      compile files('libs/android-support-v4.jar')
      compile files('/home/sebastian/dev/android/XposedMods/XposedLibrary/XposedBridgeApi.jar')
  }
  </code></pre>
  
  <p>I tried out to just add <code>compile files('XposedBridgeApi.jar')</code> or <code>compile files('XposedLibrary/XposedBridgeApi.jar')</code> but this didn't work.</p>
  
  <p>So, what is a nice way to add an AS global library to the dependencies without using full paths? (I don't like the idea of symlinking to the jar file from within the <code>lib/</code> folder ;) ) </p>