We maintain different folders to keep all the jars.
Ex:
Repo
\-- lib
\-- test
\-- junit.jar
\-- hibernate
\-- hibernate.jar
I used the bellow code.
repositories {
flatDir {dirs "../Repo/lib/*"}
}
If I put all the jars in lib it works fine. But If I put it in different folders it give the compilation error.
I tried with this
repositories {
flatDir {dirs "../Repo/lib/**"}
}
Please guide me.
First, we go to Project Structure: Then we click on the plus button on top of the list and select Java: Then a dialogue window asks us to locate the JAR file. After selecting it, we can click on OK, and our project can access the methods and classes in the archive.
Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.
When declaring a flatDir
repository, you need to pass a (relative or absolute) directory path. You can't use wildcards, but may pass multiple directory paths. For example:
repositories {
flatDir {
dirs "../Repo/lib/lib1", "../Repo/lib/lib2"
}
}
For further details, see the Gradle Build Language Reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With