Finally tried out Android Studio 4.0.1 on multiple Linux distributions. However, below is my experience on how it went. Mileage varies.
Linux Mint 20 with Android Studio without a swap file of 8 GB would hang or freeze very frequently. Technically, not a freeze but it got too slow to be able to do anything meaningful. Unfortunately, the Ubuntu based distributions do not create a swap partition when they are installed. Therefore, I moved over to Fedora 32.
Fedora 32 had very less hanging when using Android Studio and compiling code. The key advantage being that Fedora 32 creates an 8 GB swap partition on installation. I installed x86 and x86_64 emulators, but after about 8 to 10 switches between the Android Studio, Google Chrome and AVD running, the system just hanged on the x86_64 AVD with play services installed on it. So far, on x86 emulator of the AVD, there is no hanging. Note that on using Firefox together with the Android Studio and emulator running, the system got to a point where it just stood still.
Xubuntu 20.04 LTS installs without creating an 8 GB swap partition. When the AVD runs, it hangs irrespective whether Google Chrome or Firefox are open with the Android Studio. To overcome, I created a swap file of 8 GB to see if there would be an improvement. Fortunately, it worked. However, with the x86_64 AVD with Google play services, it slows to a crawl and is as good as no use for development. With x86 AVD with Google play it worked for a longer period of time, but after a while, it hanged. To overcome, I used the x86 AVD without play services. This works well. This could work on any Ubuntu based Linux distribution.
Additionally, below method to clear caches reduced hanging or freezing. Needed to do this periodically. Can also be done on any Linux distribution. However, mileage varies.
- Update Android SDK tools and latest SDK platform.
- Restart Android Studio again.
- Select the option File -> Invalidate Caches/Restart
On Xubuntu 20.04 LTS, I did the following:
- Installed the AVD and used the x86 version of the emulator. So far no hanging whatsoever.
- Set up an 8gb swap file. Note that Ubuntu based distros do not create a 8 GB swap partition.
- So far, there is no hanging.
- I ran Google Chrome, Android Studio, AVD in x86_64, opened 2 projects and compiled and ran both of them, and no hanging. Need to stress test this a bit more for confirmation. Unfortunately, with Firefox, there was sluggishness.
On an i5 8th generation, 8 GB of RAM and 1 TB of hard disk and runs Xubuntu 20.04 LTS. To reduce issues per above, it is recommended to increase the RAM to 16 gb at least.