I am trying to download an android system image on Android studio in order to emulate apps. The issue is android studio is failing to download the system image. After looking at the log it says I have no space left on my device yet I have 960GB left on my laptop.
The exact error message is
2017-11-28 20:32:13,136 [d thread 8] INFO - s.RepoProgressIndicatorAdapter - Downloading https://dl.google.com/android/repository/extras/intel/addon2-1.xml
2017-11-28 20:32:13,238 [d thread 8] WARN - s.RepoProgressIndicatorAdapter - java.io.IOException: Cannot download 'https://dl.google.com/android/repository/extras/intel/addon2-1.xml': No space left on device, response: 200 OK
Another important piece of information is my laptop runs solus Linux.
This is a very common error. Your temporary folder your system uses as a cache is full. Now, the tmp is cleaned on every reboot. However, Android Studio uses a lot of space. Below, I go over your options.
How to find out if /tmp is the problem?
On the terminal, type:
On the output, look at 'Use%' column. If the percentage is high then you are running out of space on tmp. If you do a lot of compiling or installations this will be an issue later on as well.
You have three options,
Option 1. Find out where android studio is installed and modify studio.sh file to pass on a variable. When android studio boots up, the env variable tells android manager to use the temporary folder specified.
Step 1. Find where android studio is installed. It's usually in the /opt/android-studio folder. To make life simple, the following will contain the folder directory with pattern 'android-studio/bin' from the whereis -l output.
Step 2. Use directory to open 'studio.sh' file with vim. Usually, this is /opt/android-manager/bin/studio.sh
Step 3. Copy and paste the following lines on the beginning of studio.sh . I added comments as a reminder if you ever take a look at it on a future date.
On Vim press [i] to edit. Copy from browser with [Ctrl] + [c] and Paste into vim with [Ctrl] + [Shift] + [v] keys.
Save and exit by pressing [Esc] then type ":wq"
Start android studio and try the updates again. This time, updates should be successful.
For Both Option 2 & 3 Check /tmp and make sure it's not a separate partition.
On the output, look at the Filesystem column. If that Filesystem displays a backslash followed by three letters like /sda or /sdb then don't continue and look for other instructions.
If Filesystem Column is tempfs then continue...
Option 2. Increase the size of /tmp temporarly.
That's it. Done.
Option 3. Increase size of /tmp all the time. This is useful if you see the "No space error" repeatedly with multiple programs or activities.
Step 1. Backup fstab.
Step 2. Check if you have an existing entry for 'tmpfs /tmp'
Step 3. if nothing returns on the terminal, then paste the following line. Change 6G to the size that you want for /tmp.
If you have an existing entry, manually change the size of the drive with vim or any terminal text editor.
you will see something similar to this:
Change the size integer to the size your want. For example, replace 4G with 6G.
Save & Quit. On vim, press [Esc] and type ":wq"
Finally,reboot your computer.
Hope this helps. Instructions provided at your own risk.