Skip to content Skip to sidebar Skip to footer

Jar Files In Libs Folder Are Not Used In Android Gradle Build

i just started to play with the gradle build system for Android. However i'm not able build one of my projects. It depends on a jar in the libs/ folder. Doing gradle build fails in

Solution 1:

just found the answer myself:

Seems like the current version of the Android Gradle plugin doesn't look for jars in the libs/ folder. So you have to add them yourself:

dependencies {
    compile files('libs/mylib.jar')
}

or

dependencies {
    compilefileTree(dir: 'libs', include: '*.jar')
}

Place this within the android namespace like this:

android {
    target = "android-15"

    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar')
    }
 }

Solution 2:

Just in case none of the solutions worked for you, you may want to try to provide the path to the *.jar manually:

compile files('../<your-library-folder>/<your-library>.jar')

The '../' part means that Gradle will search for the library starting from the root projects folder (not app module).

Post a Comment for "Jar Files In Libs Folder Are Not Used In Android Gradle Build"