Android Studio consuming all the system RAM and swap mermory - linux

I have ubuntu20.04LTS installed on my desktop
Android Studio version 4.1.3
Intel Pentium G645 # 2.90 Ghz dual core
6 GB of RAM
1.5GB of swap
I am learning android but my projects are not that heavy but then too my pc hangs even if I open android studio alone it just starts consuming RAM and swap memory slowly
What can I do to fix this problem please help.

Edit custom VM Options
Add or change the value of -Xmx. Units are MB (specified as m) or GB (specified as g). Here I tell it to only use 2 GB RAM:
-Xmx2g
JetBrains totally reworked the user interface recently, in fact the UI is quite fluid between major releases. Android Studio is based on the same core as IntelliJ IDEA, and for the current version you would clock on the settings icon at the lower left of the signon screen, then you will see VM settings.

Related

What is the status of Android Studio 3.5 running on Win10 with Ryzen 5 (or 7) CPU?

Really trying to not create a duplicate.
I've read the closest SO on this and it is quite old:
Android Studio and Ryzen CPU?
It's time to upgrade my hardware since my i7, 8GB RAM laptop can no longer run Android Studio and the emulator at the same time (major memory issues). Unfortunately, my laptop can only go to 8GB.
I am definitely considering a Ryzen 5 or 7 since I can save so much $$$ (compared to similar Intel choices).
On Ryzen, can I run the normal HAXM emulator? The one I'm used to running on my i7? Or do I have to run something different?
Does anyone have comparison stats? My i7 starts the emulator just about instantly on my i7. But I can no longer run the emulator and android Studio (AS) at the same time (due to RAM being eaten up by AS and associated Java runtimes).
Is running on the Ryzen not solid? Am I going to see a lot of crashes? Is it going to be so slow it drives me crazy? If not I'd rather pay the extra for the Intel chip?
Hope someone out there is an Android dev and has experience to share.
Win10 Version?
Also, I just read the requirements for Hyper-V. I'm running Windows Home edition. Do I need Windows Pro or Enterprise to run with Ryzen 5/7? Will I be required to use Hyper-V?
The following is from : https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
Windows 10 Enterprise, Pro, or Education
64-bit Processor with Second Level Address Translation (SLAT).
CPU support for VM Monitor Mode Extension (VT-c on Intel CPUs).
Minimum of 4 GB memory.
The Hyper-V role cannot be installed on Windows 10 Home.
I found the following information from July 09, 2018 (a while ago and AS 3.2 was out) that seems to indicate that :
1. Android emulator is supported and will run with AMD Ryzen chips
2. You will need to turn on Windows HyperVisor Platform (which should be available via Windows 10 Home)
https://android-developers.googleblog.com/2018/07/android-emulator-amd-processor-hyper-v.html
It also states (my emphasis shown where I am confused -- not sure what Hyper-V running at same time gives me) :
If you want to use Hyper-V at the same time as the Android Emulator
on your Intel processor-based computer, you will also need the same
Android Studio and Android Emulator versions as listed above, but with
the additional requirements:
Enable via Windows Features: "Hyper-V" - Only available for Windows 10 Professional/Education/Enterprise
Intel Processor : Intel® Core™ processor that supports Virtualization Technology (VT-x), Extended Page Tables (EPT), and
Unrestricted Guest (UG) features. Additionally VT-x needs to be
enabled in the BIOS.
More Info - Definitive Answer
My son has a machine with Gigabyte m/b and a Ryzen 5 2600x and we installed Android Studio 3.5 and made the appropriate changes tonight.
The board / CPU supports SVM (virtualization technology) so we made
that change in the BIOS.
Next we turned on the Win10 setting for Windows HyperVisor Platform.
We downloaded an x86 Oreo image via Android Studio / AVD Manager and ran it and it runs very fast and smoothly on that machine (16GB RAM).
We didn't see any problems. Loaded up a basic template app and deployed it to the Android VM and it ran great. It all looks good to me. Support for Ryzen seems to be just fine. I will be buying a board and Ryzen just like his.
Update - 2020-03-23
I did purchase the Gigabyte mainboard and the Ryzen 5 2600x and I've been running it for over 6 months now and running current versions of Android Studio (keeping it updated) during that time.
I have 16GB RAM and the CPU can run Android Studio and at least two emulators running at the same time with no problems at all.
Ubuntu Linux / Windows 10 Home Edition Dual Boot
I dual boot my machine running Ubuntu and Win10. I run Ubuntu 90% of the time because Android Studio runs so smoothly on it, but I also boot in to Win10 and Android Studio runs fine there too. (Home edition works fine.)
This confirms that the AMD processors work completely fine running the Android emulators.

Can i run Android Studio 3.2 (latest version) properly on 2GB RAM?

I really want to run the latest version of Android Studio, but i have only 2GB of RAM. Can I run it properly, including SDK?
As you can see in the Android Developers main page, in the System Requirements section:
3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android
Emulator

Android studio uses 100% CPU while just coding (no builiding)

Android Studio uses 100% CPU when I'm just coding, even if I type a single word CPU use raises to the 100% and comes to back normal, and if I keep typing it takes 100% CPU all the time.
What I have tried is :
File > Invalidate cache and Restart
Change max heap size for android studio by editing VM options
"Power Save Mode" it runs perfectly when it is turned on. but it also disables some useful features of IDE and I don't want to disable it.
removed .android and .AndroidStudio3.0 folder from c:\users\username\
Android Studio plugins are set to default. no extra plugins are added. I tried disabling a plugin that can be disabled like Git and SVN but it's still same
I'm running windows 7 64-bit OS and Android Studio 3.0 and OS which I re-installed yesterday. I did not install the JDK - Android Studio is using default OpenJDK.
I've searched on internet but it did not help. any help would be appreciated.
Unfortunately, the new Android studio do require RAM.
"
You can download Android Studio 1.5.2 which should support 2Gbs of Ram And I would also recommend you to move to Linux Ubuntu OS from Windows 10 as you can set a portion of your Hard disk space as Ram memory(4gbs recommended) during installation(Search on Youtube on how to do that)."
Source quora:
It seems your systems config is low. as Android studio cares of itself for CPU uses so it gives its best.
Reasons being
You have Core 2 duo that is too low for Android Studio.
You have 4gb Ram, that is too low again.
If you work on some large project then 2gb of ram is necessary for Android Studio. and Java takes unexpected upto 4gb or more.
Solution
Increase ram by 8gb and processor at least intel i3
kill java or invalidate cache and restart if you get stuck of hanging your android studio.
Here is my CPU uses that goes upto 3gb for Android Studio and upto 4gb for Java.
The recommended hardware requirements for Android Studio are:
Microsoft® Windows® 8/7/Vista (64-bit Recommended)
Intel i5 4th-5th gen processor.
6 GB RAM
2 GB hard disk space + at least 1 GB for Android SDK, emulator system images, and caches
Optional for accelerated emulator: Intel® processor with support for Intel® VT-x,
As Java uses it’s own Machine known as JVM(Java Virtual Machine) for program compilation and it has some complex tasks like generate classes then verify byte code and then execute program with JIT(Just In Time)
And as Android has Natively developed in Java the slow compilation will be the issue i presume. But with new Android Studio feature known as “Instant Run” compilation and development of Android apps made more easy.
As i am developer of Android apps, I use
Intel i5 6th gen 2.70 Ghz processor
12 GB of RAM (8GB in first slot and 4 in Second Both DDR3)
1 TB of Hard Drive
Nvidia G-Force 940M 2 GB of Dedicated GPU for running Adobe After-Effects, Maya and Unity like Software which needs Dedicated GPU.
That’s all and Still Android Studio sometimes Lags with such high performance Hardware with the more complex and big apps(Complex Projects).
I think if you are going to buy a hardware and use it for at-least 3 years get the exact specs i have (or similar), However if you are frequent hardware changer use specs i mentioned first.
And for Emulator use Genymotion as it is way faster then the emulator which Android provides. Or use some other alternatives like Memu, Blustacks, Andy etc.
Try to add more Heap memory for Android Studio, go to Help -> Edit Custom VM Options... and set -Xmx2g (depends on your project size), after restart AS.
Did you try to set the power plan to best performance instead of balanced plan.
This may consume the battery but may solve this problem.
If you have any USB drives laying around, try using those for ReadyBoost. It may help you.
For the uninitiated, ReadyBoost, in a nutshell supposedly makes your WINDOWS PC faster by using how much ever space you dedicate it to (aka extra RAM)
For the uninitiated, to set it up,
Plug your USB / SD /WHAT EVER DIGITAL STORAGE you have into your computer
Go into Windows Explorer > This PC > Right click on Whatever storage you have plugged in
Select Properties in the Context (right click) menu
Go to the ReadyBoost tab
Choose what to do with it
Go to: Preferences > Version Control > Background. Now listed under 'Background Operations' are 6 options. I disabled the first three options which are:
Perform update on VCS in background, Perform commit to VCS in background, Perform checkout to VCS in background.
This reduces lot of power consumption of the CPU

Android Studio / kotlin

I would like to know if my laptop suitable for Android Studio(because i faced some problems with it)
My laptop has Intel core i3 # CPU M 380 2.53 GHz
and 2 GB ram with windows 32-bit
Android studio version 2.x requirements for windows
OS version : Windows 7 or later
RAM : 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
Disk space : 500 MB disk space for Android Studio, at least 1.5 GB for Android SDK, emulator system images, and caches
Java version : Java Development Kit (JDK) 8
Screen resolution : 1280x800 minimum screen resolution
As per the above requirements your laptop has low ram (ans:as per this reason your laptop is not suitable for latest version 2.x), so you have to upgrade new ram or as per my personal opinion you have to buy new laptop which is fulfill the above requirements

How do I boost up my android studio's emulator on mac?

Android studio's emulator takes like ages to start and also crashes sometimes and at times does not show output, is very very slow.
OS X Yosemite
version 10.10.1
MacBook Pro (15-inc, late 2008)
Processor 2.4 GHz Intel core 2 Duo
Memory 8 GB 1333 MHz DDR3
Startup Disk Untitled
Graphics NVIDIA GeForce 9600M GT 256MB
If i remember correcly your MacBook do not support Hardware Accelerated Execution Manager becouse the cpu is quite old :-( (mine is too) so the default android emulator will be so so slow and there is no way to fix it
Yes you can tweek some parameters and maybe gain a second but it would be very marginal gain.
I use Genymotion is realy fast and run well on ald machines, give it a try. Is commercial product. It han the big disadvantage that there is no images with google play services.
Otherwise there is a way to run android images on "Oracle VM VirtualBox" but this way is not so easy, is hard to find a good android image and setup the envirnoment. install Android in VirtualBox
ps. if you haven't done this already upgrade hd to an ssd , it helps a lot

Resources