/tmp directory in Linux Android SDK

前端 未结 15 2186
醉话见心
醉话见心 2020-12-28 15:00

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

相关标签:
15条回答
  • 2020-12-28 15:44

    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
    
    0 讨论(0)
  • 2020-12-28 15:48

    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.

    0 讨论(0)
  • 2020-12-28 15:49

    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

    0 讨论(0)
  • 2020-12-28 15:50

    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.

    0 讨论(0)
  • 2020-12-28 15:51

    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
    
    0 讨论(0)
  • 2020-12-28 15:53

    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.

    0 讨论(0)
提交回复
热议问题