Fix Bluetooth Audio Issues with Android Simulator on macOS
October 30, 2022
There is an issue with Android Simulator where sometimes when Bluetooth audio is being used, the current audio will completely stop working when starting an emulated Android device. To fix this issue, we have to modify the config files for each of the Android devices.
Manual Method
- Change directories into the 
avdfolder for Android and open this directory in your editor - There should be folders titled with the device and OS version. For each of these folders, modify the 
config.inifile - Change or add the following lines to the file:
 
hw.audioInput=no
hw.audioOutput=no
- Open the 
Virtual Device Managerin Android Studio - For each of the devices that where the config was edited, they will need to be reset
Wipe DataCold Boot Now
 
Bash Script Method
Alternatively, running this bash script that should try to do steps 1-4 from above.
#!/bin/bash
# Find all config.ini files in the ~/.android/avd directory and its subdirectories
find ~/.android/avd -name "config.ini" | while read line
do
  # Remove any lines in the config.ini file that contain the string "hw.audio" and save to a temporary file
  awk '!/hw.audio/' $line > tmp
  # Remove the original config.ini file
  rm $line
  # Rename the temporary file to config.ini
  mv tmp $line
  # Add the hw.audioInput and hw.audioOutput properties and set them to "no"
  echo "hw.audioInput=no" >> $line
  echo "hw.audioOutput=no" >> $line
done