Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/tmp directory in Linux Android SDK

Just to tinker with it, last night I installed the Android Studio/SDK, and both during install and use, it repeatedly blew my 2Gb /tmp partition. Is there any way to tell this monster to use something other than /tmp, especially for downloading/unzipping?

Fedora release 20 (Heisenbug)

Thanks

like image 383
Chris Moller Avatar asked Jun 27 '16 15:06

Chris Moller


People also ask

What is tmp directory in Linux?

The /tmp directory is a temporary landing place for files. Users also have write access to this directory, which can be a bad thing, but there is a solution.

Where is the Android SDK folder Linux?

Linux: ~/Android/Sdk. Mac: ~/Library/Android/sdk. Windows: %LOCALAPPDATA%\Android\sdk.

What is the tmp directory used for?

Web servers have a directory named /tmp used to store temporary files. Many programs use this /tmp directory for writing temporary data and generally remove the data when it is no longer needed. Otherwise the /tmp directory is cleared when the server restarts.


2 Answers

Setting -Djava.io.tmpdir=whatever didn't work for me. I simply created $HOME/tmp/PackageOperation04 and then created a symlink from /tmp.

cd ~ mkdir -p tmp/PackageOperation04 cd /tmp ln -s $HOME/tmp/PackageOperation04 

This way the Android SDK uses my /home partition instead of /tmp for this.

like image 171
user3150128 Avatar answered Sep 24 '22 17:09

user3150128


You can change the location of the temporary directory used by the Java Virtual Machine running Android Studio. In Android Studio 2.0 or later, select Help -> Edit Custom VM Options. This will create a copy of the installation's vmoptions file in your own configuration directory and open it in the editor. Add the following line and restart:

-Djava.io.tmpdir=<directory> 

where <directory> is an absolute path to a directory in a partition with enough space. If <directory> doesn't exist, it will be created the next time Android Studio is started.

You can also edit the file directly (and need to in versions prior to 2.0), but it's location varies depending on the platform version and possibly an environment variable setting. See Configuring Android Studio: IDE & VM Options, JDK, etc. for the details.

An alternative solution would be to increase the size of /tmp which in your case is most likely a tmpfs partition and thus easily resizable.

like image 23
Paul Ratazzi Avatar answered Sep 23 '22 17:09

Paul Ratazzi