Skip to content

Instantly share code, notes, and snippets.

@gringoh
Last active September 22, 2024 11:39
Show Gist options
  • Save gringoh/4be076a41e7aaf0b9fd047b4b3ec6711 to your computer and use it in GitHub Desktop.
Save gringoh/4be076a41e7aaf0b9fd047b4b3ec6711 to your computer and use it in GitHub Desktop.
[Android: Android emulator. Reduce CPU usage on MacOS] #android

Android emulator. Reduce CPU usage on MacOS

I wasn't able to shut the audio off with the config.ini file, but only with the -noaudio cmd line argument to qemu. However, with Android Studio 3.2, you can't add custom arguments to the emulator, so I made this:

In the emulator dir of the Android SDK, in my case ~/Android/Sdk/emulator/

mv emulator emulator.orig Make a bash script called emulator with the content:

#!/bin/bash

DIR=`dirname "$0"`

$DIR/emulator.orig -noaudio $*

Then:

chmod +x emulator Now, the argument -noaudio will be added to all invocations of emulator from Android Studio and will save you a lot of CPU cycles.


Android emulator. Reduce CPU usage on MacOS editing AVD config.ini

The cause of the constant CPU usage is the sound. If you do not need sound in your emulator you can disable it by editing the AVD's config file.

Change/add those two lines

hw.audioInput=no
hw.audioOutput=no

On Linux/Mac the file is located at ~/.android/avd/<AVD_Name>.avd/config.ini On Windows the file is located at C:\Users\<username>\.android\avd\<AVD_Name>.avd\config.ini

source: https://stackoverflow.com/questions/37063267/high-cpu-usage-with-android-emulator-qemu-system-i386-exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment