title: Android studio how to reference library?
body: <p>I made a library in intelliJ. It is a rest client that I want to import it in android project. I want to develop the library seperate in intelliJ since it lets me to test it without actual android app but just in console. When I want to the import library in the android studio I get an error. I tried all the ways of importing library (a lot of them are from SO). This is what I do:</p>
  
  <p>I go to project structure, choose dependencies and add from folder in which I have .jar file that I made in intelliJ. In IntelliJ I did Artifact and then build it as .jar. I moved that to android studio and it does not work. Bellow is the error I get when trying to compile project in Android studio.</p>
  
  <pre><code>     Error:Execution failed for task ':app:preDexDebug'.
  </code></pre>
  
  <blockquote>
    <p>com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        C:\Users\Gregor\AppData\Local\Android\android-studio\sdk\build-tools\android-4.4.2\dx.bat --dex --output C:\Users\Gregor\AndroidStudioProjects\Perla\app\build\pre-dexed\debug\PerlaRestAPI-985193a1adafac50f74c01c1069cd74ce9c69b55.jar C:\Users\Gregor\AndroidStudioProjects\Perla\app\libs\PerlaRestAPI.jar
    Error Code:
        1
    Output:
        UNEXPECTED TOP-LEVEL EXCEPTION:
        com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
            at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
            at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
            at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
            at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
            at com.android.dx.command.dexer.Main.processClass(Main.java:665)
            at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
            at com.android.dx.command.dexer.Main.access$600(Main.java:78)
            at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
            at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
            at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
            at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
            at com.android.dx.command.dexer.Main.processOne(Main.java:596)
            at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
            at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
            at com.android.dx.command.dexer.Main.run(Main.java:230)
            at com.android.dx.command.dexer.Main.main(Main.java:199)
            at com.android.dx.command.Main.main(Main.java:103)
        ...while parsing api/Game.class
        1 error; aborting</p>
  </blockquote>