Skip to content

Instantly share code, notes, and snippets.

@m3ftah
Created November 21, 2017 08:26
Show Gist options
  • Select an option

  • Save m3ftah/a3eaffe3d022d87ec4bfc66d8706d8aa to your computer and use it in GitHub Desktop.

Select an option

Save m3ftah/a3eaffe3d022d87ec4bfc66d8706d8aa to your computer and use it in GitHub Desktop.
Minimize the Android emulator used memory and disk size
#You can find the docker image in https://hub.docker.com/r/m3ftah/androfleet-emulator/ and the source code : https://github.com/m3ftah/androfleet/tree/restart/docker/androfleet-emulator
ANDROID_HOME="/opt/android-sdk-linux"
ANDROID_SDK_HOME="${ANDROID_HOME}"
PATH="${PATH}:${ANDROID_SDK_HOME}/tools:${ANDROID_SDK_HOME}/platform-tools"
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
cd /tmp && \
curl -O https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && \
cd /opt && tar xzf /tmp/*.tgz && rm /tmp/*.tgz
echo "y" | android update sdk --no-ui --force -a --filter android-15,sys-img-x86-android-15,platform-tools
#Here we minimize the image size from 2G to 50M, when you run 100 emulator you will gain 150G of disk usage.
resize2fs /opt/android-sdk-linux/system-images/android-15/default/x86/userdata.img 50M
echo "n" | android create avd --force -n nexus -t android-15 -b default/x86
emulator64-x86 @nexus -noaudio -no-window -gpu off -no-skin -qemu -usbdevice tablet -vnc :0 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment