284

There are a lot of system images piling up on my disk in the android sdk folder. i hardly use the emulator. May be once in 6 months. Most of my development is directly on device. What i wanted to check was, will removing the system images (at least for the old APIS i.e. < 22) impact the development?

Also, the google apis folder seen below. Should i keep it for all versions or just the one in the latest suffice?

enter image description here

Screenshot above is from WinDirStat tool. - https://windirstat.net

Viral Patel
  • 32,418
  • 18
  • 82
  • 110

9 Answers9

229

System images are pre-installed Android operating systems, and are only used by emulators. If you use your real Android device for debugging, you no longer need them, so you can remove them all.

The cleanest way to remove them is using SDK Manager. Open up SDK Manager and uncheck those system images and then apply.

Also feel free to remove other components (e.g. old SDK levels) that are of no use.

frogatto
  • 28,539
  • 11
  • 83
  • 129
  • Thanks for the detailed answer abforce ... makes it clear. One last doubt. The google_apis folder seen inside each android version in the screen shot above is also required only for the system images right? they can be removed too? – Viral Patel Jun 12 '15 at 07:56
  • can we move those file to different drive, if yes then what all the setting needs to be done post moving the images – sameer Feb 09 '17 at 07:14
  • @sameer You can move it and then point your IDE to where the SDK Manager is. I tried that once, but it caused my Eclipse to take 5 minutes to just open everytime... deleting the system images saved me 40GB on my SSD! – Demonslay335 Mar 15 '17 at 17:32
  • There is many Android SDK Build-tools in my sdk manager, deleting old revisions may cause in any error or affect on performance? – Shima Erfan Dec 31 '17 at 19:57
149

You do not need to keep the system images unless you want to use the emulator on your desktop. Along with it you can remove other unwanted stuff to clear disk space.

Adding as an answer to my own question as I've had to narrate this to people in my team more than a few times. Hence this answer as a reference to share with other curious ones.

In the last few weeks there were several colleagues who asked me how to safely get rid of the unwanted stuff to release disk space (most of them were beginners). I redirected them to this question but they came back to me for steps. So for android beginners here is a step by step guide to safely remove unwanted stuff.

Note

  • Do not blindly delete everything directly from disk that you "think" is not required occupying. I did that once and had to re-download.
  • Make sure you have a list of all active projects with the kind of emulators (if any) and API Levels and Build tools required for those to continue working/compiling properly.

First, be sure you are not going to use emulators and will always do you development on a physical device. In case you are going to need emulators, note down the API Levels and type of emulators you'll need. Do not remove those. For the rest follow the below steps:

Steps to safely clear up unwanted stuff from Android SDK folder on the disk

  1. Open the Stand Alone Android SDK Manager. To open do one of the following:
  • Click the SDK Manager button on toolbar in android studio or eclipse
  • In Android Studio, go to settings and search "Android SDK". Click Android SDK -> "Open Standalone SDK Manager"
  • In Eclipse, open the "Window" menu and select "Android SDK Manager"
  • Navigate to the location of the android-sdk directory on your computer and run "SDK Manager.exe"

.

  1. Uncheck all items ending with "System Image". Each API Level will have more than a few. In case you need some and have figured the list already leave them checked to avoid losing them and having to re-download.

.

  1. Optional (may help save a marginally more amount of disk space): To free up some more space, you can also entirely uncheck unrequired API levels. Be careful again to avoid re-downloading something you are actually using in other projects.

.

  1. In the end make sure you have at least the following (check image below) for the remaining API levels to be able to seamlessly work with your physical device.

In the end the clean android sdk installed components should look something like this in the SDK manager.

enter image description here

Viral Patel
  • 32,418
  • 18
  • 82
  • 110
  • 9
    Removing *system images* in the SDK manager is the cleanest solution. This should at least have more upvotes, or even be the accepted answer. – Levite Jun 02 '16 at 07:51
  • 4
    Thanks @Levit this is an answer to my own question which I posted later because I thought people would benefit out of knowing this approach. The answer I've marked accepted is the one that actually helped me that time. – Viral Patel Jun 02 '16 at 07:56
  • 1
    This was very helpful, thank you. The only modification to your steps I would suggest is to step #2. You want to CHECK the items you wish to remove, and then click the Delete Packages button on the bottom-right. Thanks again! – Adam Plocher Jul 12 '16 at 21:52
  • Thank you so much, I didn't know the sdk was downloading emulator images (My mac was crying it ran out of space until I saw this post). – ScarletMerlin Sep 28 '17 at 14:13
  • The question is "_Do we need to keep all of the System Images?_" and this does not answer that question. – Sam Hobbs Feb 25 '18 at 23:24
  • Thanks, @AndroidMechanic-ViralPatel. I tried and it works. – Subhash Patel Nov 28 '18 at 11:14
  • 1
    Consider updating your answer, as the newer versions of Android Studio now stores Android SDKs in this location: `C:\Users\ username \AppData\Local\Android\Sdk`. Also, I don't know if it's just me or there is no Standalone Android SDK Manager in the newer versions of Android Studio. – Lloyd Dominic May 24 '20 at 08:04
8

I had 20.8 GB in the C:\Users\ggo\AppData\Local\Android\Sdk\system-images folder (6 android images: - android-10 - android-15 - android-21 - android-23 - android-25 - android-26 ).

I have compressed the C:\Users\ggo\AppData\Local\Android\Sdk\system-images folder.

Now it takes only 4.65 GB.

C:\Users\ggo\AppData\Local\Android\Sdk\system-images

I did not encountered any problem up to now...

Compression seems to vary from 2/3 to 6, sometimes much more:

android-10

android-23

android-25

android-26

ggo
  • 471
  • 7
  • 17
  • 1
    how did you compress it? – krv Jul 21 '17 at 14:06
  • 1
    right click on the folder to compress (system-images folder here) => Properties => Advanced => enable "Compress contents to save disk space" => OK => Apply => select "Apply change to this folder, subfolders and files" (should be selected by default), and click OK. (may be it's better to quit Android Studio and close the emulators currently running before compressing, since some files may be locked). – ggo Jul 22 '17 at 20:02
  • 3
    This will impact performance, so do it only for rarely used files (excluding already compressed files like photo, video, zip, jar etc). – Leon Jan 13 '19 at 03:12
8

This is the minimal stuff I keep for day to day Android development (including production code). Latest versions from API 25 to API 27 (Nougat to Android P) included only, and you can work great with it.

  • To minimize even more, just keep any one of the below versions as same and keep a lower versions i.e. API 16 with same files downloaded as below.

Sneh Pandya
  • 8,197
  • 7
  • 35
  • 50
6

I recommend two steps to address the bloated SDK problem.

First, I removed all but two versions of Android:

  1. The current version, e.g. 6.0 Marshmallow as of this writing. This version is to test and develop to the latest and greatest that the current Nexus handsets are running plus a couple of other brands.

  2. An older version, e.g. 4.04 Ice Cream Sandwich. This is to provide compatibility for the vast majority of handsets. You lose some functionality of the newer versions, but you gain a lowest common denominator of compatibility.

Second, I removed the emulators, and kept only the above two. I told it not to store the complete system state to disk, which it does indeed warn you will take up a lot of space, though it does make start-up faster. Just start up the emulator before you go make your coffee in the morning :)

If that's too much space, remove the emulators completely. Pick up a couple of older handsets off Ebay that will provide you with all the test platforms you need. They don't even have to be completely functional -- many apps don't need a SIM and cellular connectivity, for example.

My Android environment was taking up 32 gigs on my 128-gig Macbook Air. Couldn't keep doing this. Some day they'll make terabyte Macbook Airs but until then, got to slim down.

Blisterpeanuts
  • 844
  • 1
  • 10
  • 16
  • The original question does say "_Most of my development is directly on device._" but for all of us that use an emulator this is the **only** answer to the question "_Do we need to keep all of the System Images?_". – Sam Hobbs Feb 25 '18 at 23:28
5

There is the way to safely removed system-image

Go in SDK Manager in toolbar :

enter image description here

enter image description here

Go in Android SDK :

enter image description here

In tab SDK Platforms, uncheck which platform you want unistall :

enter image description here

Click ok and confirm deletion :

enter image description here

Kevin ABRIOUX
  • 16,507
  • 12
  • 93
  • 99
2

By deleting all emulator, sometime memory will not be reduce to our expectation. So open below mention path in you c drive

C:\Users{Username}.android\avd

In this avd folder, you can able to see all the avd's which you created earlier. So you need to delete all avd's that will remove all the unused spaces grab by your emulator's. Than create the fresh emulator for you works.

Narender Gusain
  • 2,220
  • 17
  • 13
1

In addition to the other answers, the following directory contains deletable system images on a Mac for Android Studio 2.3.3. I was able to delete the android-16 and android-17 directories without any problem because I didn't have any emulators which used them. (I kept the android-24 which was in use.)

$ pwd
/Users/gareth/Library/Android/sdk/system-images

$ du -h
2.5G    ./android-16/default/x86
2.5G    ./android-16/default
2.5G    ./android-16/google_apis/x86
2.5G    ./android-16/google_apis
5.1G    ./android-16
2.5G    ./android-17/default/x86
2.5G    ./android-17/default
2.5G    ./android-17
3.0G    ./android-24/default/x86_64
3.0G    ./android-24/default
3.0G    ./android-24
 11G    .
Gareth Randall
  • 153
  • 1
  • 6
0

In this folder there are all emulator images. If you don't use emulator then you can delete this folder.

Ahmad Nawaz
  • 1,129
  • 7
  • 26