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 t
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.
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...
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"
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
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
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 ...