Add library to gradle build

The simplest way is to use maven repository for accessing dependencies.

You can also access this jar directly from filesystem with file dependencies.

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

You could declare it as a dependency, if it exists in any remote repository. That's the way I would do it.

But if you want to use the local file, do not put it in src/main. Use an extra folder called lib or similar on the same directory level as src or you build script.

Then you can add the local dependency to the build.gradle as in this sample:

repositories {
    //central maven repo
    mavenCentral()
}

dependencies {
    //local file
    compile files('libs/toxiclibscore.jar')

    //dependencies from a remote repository
    compile 'java3d:vecmath:1.3.1', 'commons-lang:commons-lang:2.6'
}