Where is Android SDK download cache folder?

Viewed 2491

The goal here is to copy and paste downloaded Android SDK packages to multiple computer and run ./sdkmanager 'xxx' to install them locally (with no access to dl.google.com).

I tried ~/Library/Android/sdk/temp and ~/.android/tmp with no luck.

2 Answers

On linux it is in /tmp/PackageOperationX where X is a number.

MacOS

commandline sdkmanager

the temporary files will be downloaded to /private/var/folders/ when regular professional users couldn't comprehend how this decision can be made by developers of this commandline tool and MacOS, and still not informing their users in documentation

For example, to find out the file while sdkmanager is downloading the package system-images;android-29;google_apis;x86_64, with zip file named "x86_64-29_r11.zip":

lsof | grep x86_64-29_r11.zip

## output
java      5422 username   35w      REG                1,7 408368096            19062984 /private/var/folders/t7/z9lknwrd31q55t9m7s4qhm140000gp/T/PackageOperation02/x86_64-29_r11.zip

Using find also can work, but if you are searching for / it will take longer, so you can try on /private directly

sudo find / -name "*x86_64-29_r11.zip*" 2> >(grep -v 'Operation not permitted' >&2)

sudo find /private -name "*x86_64-29_r11.zip*" 2> >(grep -v 'Operation not permitted' >&2)

Source for coming up with the solutions:

  1. See what process is using a file in Mac OS X
  2. How can I exclude all "permission denied" messages from "find"?

Android Studio SDK Manager

the location for temporary storage of packages downloaded is $HOME/Library/Android/sdk/.downloadIntermediates and will be moved to $HOME/Library/Android/sdk/.temp/PackageOperation0X for extracting operation where X is a number. These packages will be deleted once they are extracted to their respective directories.

Related