10

I've got a very weird problem - my audio works perfectly, even under massive CPU load, but as soon as I start the Android Studio IDE, it becomes super laggy and distorted with glitches, cracks and pops. And this problem only occurs with Android Studio, and no other program!

I tried a lot of things:

  • Disabling timer-based scheduling
  • Giving pulseaudio better niceness value
  • Enabling realtime settings
  • Trying another sound card
  • Trying other Java applications, they don't show the same problem
  • Disallow resampling
  • Setting the default sample rate
  • Trying out IntelliJ IDEA, since Android Studio is based on that. The problem does not appear here.

Nothing fixed the issue. Does anybody know a solution for this?

My specs are:

  • Amd Ryzen 9 3900X 12 core CPU
  • 32 GB DDR4 RAM
  • Main drive is a M.2 SSD

P.S. I'm not using the Android emulator, just the IDE

nshct
  • 101
  • Android studio needs some RAM, so it's possible that your computer is swapping because Android studio (+ other loaded programs) are filling the RAM, and pulseaudio must use swapped RAM (I experimented that with a 4 Go RAM computer, Android Studio + Chrome were filling almost 3 Go/ 4 Go, add Windows programs - I code on Windows for Java, sorry :( ). Best thing to share is your computer specs as RAM + CPU – damadam Oct 24 '19 at 14:32
  • @damadam Its definitely not the RAM, as I have 32GB and its only 4GB full when the problems occur. I added the specs :) – nshct Oct 24 '19 at 15:02
  • Does this happen just opening Android Studio or actually doing something with it? – WinEunuuchs2Unix Oct 26 '19 at 23:30
  • @WinEunuuchs2Unix It happens on just opening Android Studio with a project. I don't even have to click anything. Weird thing is that Android Studio is based on the IntelliJ IDE, and that one does not give me these problems. – nshct Oct 27 '19 at 00:43
  • Does it happen without opening your project? – WinEunuuchs2Unix Oct 27 '19 at 01:24
  • Did you check your initial RAM and max RAM setting for Android Studio? Android Studio is incredibly slow and laggy – WinEunuuchs2Unix Oct 29 '19 at 23:42
  • When you say Android IDE, does it mean that a project is loaded or is it just Android Studio showing you a list of projects to open? Also, what happens when you open more than one instance of Android Studio (as in open another project in Android Studio and click on New Window when it asks where you want this project to open)? – Domo N Car Oct 31 '19 at 09:26
  • Android Studio should not be using as much memory to distort the audio as you are saying. And it is clearly not related to Ubuntu as well. – Jishan Shaikh Nov 01 '19 at 12:12
  • I'd say I have almost the same problem when opening AS, but my problem is that mouse became laggy for some reason(you move mouse across screen and it's start freezing with almost same periods of time, like some process is probing something). I have similar specs, using Ubuntu and just opening AS with project introduces the problem. Windows's AS on other hand doesn't have this problem. – Outofdate Jan 10 '20 at 00:23
  • I have identical issue. Glitches from all audio players (spotify, google music, lollipop, ...) right after opening AS. 32Gb memory, ssd. No emulator started. Tons of free memory. Started happening when updated to ubuntu 19.*, still getting on fresh 20.04. @nshct, did you find solution? – Michael Sotnikov Sep 10 '20 at 20:01
  • 2
    I've faced with the same issue. I see no answers here, so I'm trying to investigate with attraction affected projects: * https://youtrack.jetbrains.com/issue/IDEA-252399
    • https://issuetracker.google.com/issues/170230081
    • https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1003
    – AlexWayfer Oct 08 '20 at 15:41
  • 1
    Just discovered that I have this issue only when external DAC is involved (I have 2 DACs from FiiO). When switched to HDMI audio (nvidia) - no issues. So, maybe this issue is somehow related to USB Audio, since it's Isochronous and it does not guarantee data integrity, it can identify if data is corrupted (via CRC check) but can not recover an error. – Michael Sotnikov Oct 12 '20 at 09:01

1 Answers1

6

Finally I found the root of the issue - it's the ADB daemon.

Killing the daemon fix the problem, but AS will restart it anyway (and for sure it's a bad solution).

The right way is to check the Use libusb backend option in Settings > Build, Execution, Deployment > Debugger > Android Debug Bridge

TIP: You can search for "Use libusb backend" in settings window to find it quickly.