Search code examples
androidgradleandroid-gradle-pluginandroid-sdk-toolsandroid-build

minimum amount of android sdk files needed to build a release apk from command line


I have the android SDK installed on a aws Ubuntu server (14.04). I have a ruby application which builds an APK and it is working fine on my development environment.

However the android SDK is very large and has taken up half of the space i have availible on the server (4Gb)

All i need from the sdk is to have it run is:

./gradlew assembleRelease

and sign the apk with a keystore using jarsigner

As you can see platforms is taking up the bulk of it:

:~/sdk/android-sdk-linux$ du -h --max-depth=1 | sort -hr
3.9G    .
2.2G    ./platforms
775M    ./add-ons
469M    ./extras
398M    ./tools
104M    ./build-tools
11M ./platform-tools
4.0K    ./temp

Here's a list of what's inside:

android-10  android-13  android-16  android-19  android-22  android-8
android-11  android-14  android-17  android-20  android-23  android-9
android-12  android-15  android-18  android-21  android-7   android-N

I have already removed the docs directory which almost took up 1Gb but I'm unsure of what else i can remove. All suggestions are much appreciate, thanks for your time


Solution

  • For platforms, you only need whichever one(s) that you are using in your project(s) that you are building. So, examine those project(s) and see what you have for compileSdkVersion values. You can remove the platforms subdirectories corresponding to ones that you do not need.