3

I'm using Android Studio to develop android apps recently and most differently from Eclipse, it uses gradle as build tools. Gradle is really handy of course, I don't need to download jar and put it into libs folder anymore, gradle will download all dependencies i need for me and cache them in my laptop. For exmaple, OkHttp cache file will be somewhere like this:

C:\Users\tony\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp\okhttp\2.6.0\212387a39088ecd3daff8e3bfc3bdc4123e33c67

Now I'm just confused about the final part. What does the directory means named as 212387a39088ecd3daff8e3bfc3bdc4123e33c67. How does gradle generating it and the generating rules? Cause i found when i copy the cache files to another laptop it won't work. Gradle will download all of them again and generate another random directory name. Hope someone can help me. Thanks a lot!

Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98
Tony Green
  • 377
  • 1
  • 4
  • 9
  • `How does gradle generating it and the generating rules?` what do you want to know it for? it is gradle's internal implementation that can change at any version change – pskink Feb 23 '16 at 08:37
  • Cause i have a PC which can't connect to Internet. Forbidden by company, which i couldn't download dependencies online. So i wanna copy these cache files from my laptop to this PC directly instead of download them online. But it seems not work, so i guess it might be some generating rules in this PC that gradle finds a different directory. Any suggestions? – Tony Green Feb 23 '16 at 09:08

1 Answers1

3

The alpha-numeric string is the dependency file's SHA1 checksum. From gradle documentation:

The storage path for a downloaded artifact includes the SHA1 checksum, meaning that 2 artifacts with the same name but different content can easily be cached.

If you're looking for how to move gradle cache between computers, see here:

https://stackoverflow.com/a/34973244/745574

Community
  • 1
  • 1
RaGe
  • 22,696
  • 11
  • 72
  • 104