soufiane el hamri
soufiane el hamri

Reputation: 91

Android Emulator causing problems to audio to sound on macOS

I connected my bluetooth headphone to my iMac and started listening to music, After starting Android emulator the sound quality became horrible. I am using macOs Mojave 10.14.6 and running Android 11.0 on the emulator.

Upvotes: 9

Views: 1598

Answers (3)

Arkady Gamza
Arkady Gamza

Reputation: 191

Apart from adding

hw.audioInput=no 
hw.audioOutput=no

to the config.ini, I had to set up an environment variable (and make it persist the mac reboots) with following commands:

# Define the plist path
PLIST_PATH="$HOME/Library/LaunchAgents/studio.emu.params.plist"

# Create the LaunchAgents directory if it doesn't exist
mkdir -p "$HOME/Library/LaunchAgents"

# Write the plist content using 'cat' and 'tee'
cat <<EOF | tee "$PLIST_PATH"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>studio.emu.params</string>
    <key>ProgramArguments</key>
    <array>
      <string>launchctl</string>
      <string>setenv</string>
      <string>studio.emu.params</string>
      <string>-writable-system,-noaudio</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>
EOF

# Load the plist file into launchctl
launchctl load "$PLIST_PATH"

# Verify that the environment variable is set
launchctl getenv studio.emu.params

Upvotes: 0

TheScrappyDev
TheScrappyDev

Reputation: 4963

For me the sound was muffled as soon as I started up the android emulator.

This solution worked for me:

https://www.reddit.com/r/androiddev/comments/qsobx4/comment/hkfcxuu/?utm_source=reddit&utm_medium=web2x&context=3

If you don't care about sound on your emulator, you can turn it off:

  1. In the Virtual Device Manager, for the emulator in question, choose "show on disk"

  2. Look for the file config.ini and open it

  3. Add these 2 lines at the bottom of the file:

hw.audioInput=no

hw.audioOutput=no

  • One of those lines is probably already in the list (with a yes), so make sure to remove it

enter image description here

enter image description here

Upvotes: 6

arrmani88
arrmani88

Reputation: 1072

Start the emulator, and then disconnect your headphone, then reconnect it again.

Upvotes: 12

Related Questions