Add Support for External Libraries in Gradle Build File
- Create a directory in the Android project for keeping the external library
.jarfiles, e.g.libs - In
build.gradle, add
android {
...
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
...
}
This causes Gradle to include all the .jar files in the directory libs in the build.
Add the Apache Commons Library
- Download the desired Apache Commons library from http://commons.apache.org/
- Place the main
.jarfile of the library inlibs - Build as usual (
./gradlew assembleDebug)