First of all, I know how to add a local library to the build.gradle file, it has already been discussed in several issues here (they are all basically the same), see here , here and here . But you must hard-coded the paths in the compile files('/path/to/lib.jar') in the build.gradle file, which is not good, but not redistributable, etc. If you use a library that is not included in project folder structure. I prefer to maintain this library for all my projects in the same place (so this is always true for all projects, etc.). Therefore, I would like to know how to add a library that is not accessible through Maven to an Android-Studio project using gradle in a reasonable way, given that the library is added as a global library to AS preferences.
What i have done so far:
I use the new Google Android studio, which uses gradle to control the assembly, to create the Xposed framework module . To do this, I must include the external XposedLibrary library, which I downloaded from the corresponding Github repository in order to keep it up to date.
It contains the jar XposedLibrary/XposedBridgeApi.jar , which I added to AS as a global library (Ctrl + Shift + Alt + S β Global Libraries β green plus to add the XposedLibrary folder). Compilation error, complaining that she does not know the imported classes. Therefore, I had to manually add the library to the build.gradle file, adding the appropriate line depending on something like:
dependencies { compile files('libs/android-support-v4.jar') compile files('/home/sebastian/dev/android/XposedMods/XposedLibrary/XposedBridgeApi.jar') }
I tried just adding compile files('XposedBridgeApi.jar') or compile files('XposedLibrary/XposedBridgeApi.jar') , but that didn't work.
So what is a good way to add a global AS library to dependencies without using full paths? (I don't like the idea of ββsymbolically linking to a jar file from the lib/ ; folder))
source share