Is there a way that makes gradle download dependency libraries to the project directory, just like maven does? I know that gradle keeps its own cache in local machine directory, but how can I know what libraries will be used for my project, especially the library I defined in the build.gradle file has its own dependency?
The Gradle dependency cache consists of two storage types located under GRADLE_USER_HOME/caches : A file-based store of downloaded artifacts, including binaries like jars as well as raw downloaded meta-data like POM files and Ivy files.
gradle folder. The compiled scripts are usually in the . gradle folder in your project folder. Now if you run gradle showMeCache it should download the dependencies into the cache and print the full path.
Simply open the gradle tab (can be located on the right) and right-click on the parent in the list (should be called "Android"), then select "Refresh dependencies". This should resolve your issue.
To know what libraries will be used for your project you can use dependencies task. It will help you to find out the dependencies of your module and its recursive dependencies.
If your module name is app
, then you can try gradle :app:dependencies
in the project directory. You'll get something like below as output.
compile - Classpath for compiling the main sources.
\--- com.android.support:appcompat-v7:22.2.0
\--- com.android.support:support-v4:22.2.0
\--- com.android.support:support-annotations:22.2.0
Here com.android.support:appcompact-v7:22.2.0
is dependency of the module and the one below is its recursive dependency.
If you really what to get the dependencies in your project directory, then you can create a task for it like this.
task copyDependencies(type: Copy) {
from configurations.compile
into 'dependencies'
}
now you can run gradle :app:copyDependencies
to get all the dependencies in location <projectDir>/app/dependencies
. Note that this just give you the dependencies in your project directory and gradle is still resolving the dependencies from the local cache.
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