Reputation: 461
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
Upvotes: 27
Views: 16039
Reputation: 6238
Here is What I did and worked:
mkdir -p ~/PackageOperation01 /tmp/PackageOperation01
sudo mount --bind PackageOperation01 /tmp/PackageOperation01
$ANDROID_HOME/tools/bin/sdkmanager "system-images;android-29;google_apis;x86_64"
Upvotes: 0
Reputation: 5
I have an alternate version using symlinks. The other solutions didn't work for me, as the PackageOperation0* symlinks got always deleted. But creating a symlink inside this folder for the unzip folder did work:
cd ~
mkdir -p tmp/PackageOperation01
mkdir -p tmp/PackageOperation01/unzip
cd /tmp/PackageOperation01
ln -s $HOME/tmp/PackageOperation01/unzip unzip
Upvotes: 0
Reputation: 1
I have it resolve by changing tmpfs reference folder to /var/tmp. Add this after line containing #!bin/sh in android-studio.sh :
export TMPFS=/var/tmp
Upvotes: 0
Reputation: 1201
Another option would be to temporarily increase the size of your /tmp
partition. To do so, you need to execute the following: sudo mount -o remount,size=10G /tmp/
This would increase the size of your partition to 10GB. Please use df -h
to check that everything went well.
Upvotes: 3
Reputation: 69410
Setting java.io.tmpdir
as others have said used to work for me, but unzipping system images are still using /tmp
in Android Studio 3.0.1. It wasn't reliably using the same PackageOperation0x
directories so I didn't really want the special symlinks for them as in user3150128's answer.
Since it's only a problem when needing new SDKs and images, I ran Android Studio once and successfully did the update by setting TMPDIR
on the command line:
$ TMPDIR=/path/to/bigger/tmp/dir /path/to/android/studio.sh
Upvotes: 1
Reputation: 11
After previous suggestions did not work for me, I want to add another (not very clean) solution:
Upon starting to install a new virtual device (still using /tmp) the file
~/Android/Sdk/system-images/android-< version >/google_apis/x86/.installer/.installData
is created, which contains the temp path. Cancel the download, edit the temp path to your desired folder and restart the installation of the device.
I later realized that the solution adding -Djava.io.tmpdir=< tempdir >
as suggested by Paul Ratazzi via Help -> Edit Custom VM Options did not work for me, since it was added to android-studio/bin/studio64.vmoptions
but adding it to android-studio/bin/studio.vmoptions
instead did the job for me. That is probably the better way to do it...
Upvotes: 1
Reputation: 41
I succeed to unzip manually a system image to Sdk/system-images/android-xx after android studio flooded my 4GB tmp partition ...
Thus we have just to unzip to the right place.
Apparently it creates a /tmp/PackageOperationxx for each download, perform the download, ask you to proceed, unzip the content in tmp and move it to the right place.
Seriously android guys ...
Upvotes: 2
Reputation: 71
From this comment on a blog post work for me:
Create a directory
$ mkdir /opt/android-studio/tmp
At the top of studio.sh add:
export _JAVA_OPTIONS=-Djava.io.tmpdir=/opt/android-studio/tmp
Upvotes: 7
Reputation: 1
Solution with symbolic links will not work because at the presence directory or link /tmp/PackageOperation0* Android Studio creates a directory /tmp/PackageOperation0* + 1.
For example we have created a symbolic link /tmp/PackageOperation01 and and started to download system images, Android Studio just create directory /tmp/PackageOperation02 and will work with her.
Upvotes: 0
Reputation: 99
Chris Moller's answer made me curious to check source code if there is better way how to fix this /tmp/ issue. And I can see that Android studio 2.3 has option STUDIO_VM_OPTIONS which allows specify file with JDK options.
So you can just use snippet below and /var/tmp/androidTmp will be use instead of /tmp
echo "-Djava.io.tmpdir=/var/tmp/androidTmp" > ~/android-studio-tmp.fix
STUDIO_VM_OPTIONS=~/android-studio.fix android-studio
Upvotes: 8
Reputation: 1
I fought with the "no space left on device" problem for almost a week. (I will not be beaten!) I tried everything I found here and on other sites and the problem continued. I finally got Android studio completely installed and working correctly using the following approach:
PackageOperation01
on a partition with 100G space.tmp
directory and removed everything I felt was safe to remove, including PackageOperation01
folder.tmp
directory I created a link pointing to the new PackageOperation01
folder I had created.PackageOperation01
. This allowed me to install ALMOST everything.I still had two errors (.."no space..."). Going back to the tmp
directory I found my link to PackageOperation01
had been removed by the installer and a new directory named PackageOperation07
had been created.
PackageOperation07
from tmp
and created a new folder named PackageOperation07
on my large partition beside PackageOperation01
.PackageOperation01
folder and created a new link to the PackageOperation07
folder.This time Android Studio installed with no errors.
Upvotes: 0
Reputation: 11
You can use a file for your /tmp
:
as root:
create a file the desired size ((example for a 10 GiB /tmp size):
dd if=/dev/zero of=/path/to/your/tmp_dir bs=1024M count=10
create a filesystem on it:
mke2fs -j /path/to/your/tmp_dir
the partition is ready, mount it:
mount -t ext3 -o loop /path/to/your/tmp_dir /tmp
source : https://www.yourhowto.net/increase-tmp-partition-size-linux/
Upvotes: 1
Reputation: 455
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.
Upvotes: 41
Reputation: 6397
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.
Upvotes: 17
Reputation: 461
Did a little poking around in the code. The solution is to to start the JVM with a command-line argument that overrides the default tmpdir path:
-Djava.io.tmpdir=whatever
There may be more subtle ways to do it but all I did was edit .../android-studio/bin/studio.sh to replace
VM_OPTIONS=""
with
VM_OPTIONS="-Djava.io.tmpdir=/mnt/disk5/android/tmp"
Upvotes: 7