A downloaded dependency, e.g. log4j
is cached in the Gradle user home directory like ~/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j
.
But why modules-2
and files-2.1
instead of modules
and files
?
It doesn't look like the version of Gradle. For instance, there is no "6" or "6.0" while I'm using Gradle 6.0 on my PC.
~/.gradle/caches/jars-1
~/.gradle/caches/jars-2
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2
~/.gradle/caches/modules-2/files-2.1
~/.gradle/caches/transforms-1
~/.gradle/caches/transforms-2
The local build cache uses a system directory to store tasks outputs. The default location is the Gradle user home directory that points to $USER_HOME/. gradle/caches. Every time we run the build in our system, artifacts will be stored here.
Clear your project directoryClear the cache of Android Studio using “File -> Invalidate Caches / Restart” choose “Invalidate and restart option” and close Android Studio. Remove your . gradle directory from the root of your project. It contains some Gradle cache files.
gradle folder inside your home directory. It consist of native (information about your system) and caches. Caches further consist of plugins and all other jars dependencies.
The numbers refer to different layouts needed by different versions of gradle. Whenever there is a breaking change in the cache layout in a new version of gradle these numbers will be incremented.
If a new version of gradle still uses the same cache layout as the previous one, these numbers don't get incremented. Thus the new version can use the already existing caches without wasting disk space.
For example the number of the modules, files and metadata directory changed with this commit for a layout change introduced with gradle 1.9
https://github.com/gradle/gradle/commit/aace47c2e5f8d137fadc6b07baf84371efb48c09
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