I am trying to run two AVDs side by side. The thing is that whichever AVD I open second, runs MUCH slower than the first one. It's not CPU or RAM, there is enough overhead.
Any ideas?
I was also experiencing the same issue where the 2nd emulator was slow as molasses. I did some research on this and I think I have found a pretty decent solution. I am assuming that you have already installed Intel HAXM. If not, then please do so.
For best performances, it is advised that you allocate atleast half of the system RAM to Intel HAXM. This has been mentioned on the Intel HAXM page here under the Tips & Tricks section.
I allocated about 6 GB RAM to Intel HAXM and after that the performance of the 2nd emulator improved by a great deal. I would highly recommend you do the same. If you have already installed Intel HAXM, then please uninstall it and install it again with the amount of RAM as suggested on the above mentioned page.
Increase the memory that can be allocated to HAXM. When you install it you will notice a line in the final screen:
Note: The memory reservation setting can be changed by running this installer again.
Navigate to AndroidSDKDirectory/extras/intel/Hardware_Accelerated_Execution_Manager
Run the installer (not the silent installer) and manually adjust the HAXM memory limit on this screen:
At the time of this writing a stock Pixel (XL) emulator uses 1536 MB memory by default. So if you want to have enough memory available to HAXM to run 2 of these emulators, allocating ~4096 MB (a third more than necessary) is a safe bet.
Related
I'm trying to use the android emulator coming with Android Studio (4.0) on Mint 18. Unfortunately as soon as I run a device, my disk sees heavy workload and I can't really tell why - it must be many small writes as I can see in nmon. This renders the whole emulation completely useless as the emulated device is not really responding any longer. It does not depend on which device I'm trying to emulate (Pixel/Pixel2/own HW).
What I can't see is, which files are affected and why. Even iotop only tells me that qemu-system-i386 is putting some workload on the disk but not where (of course).
The only thing I can tell is that all magic disappears if I start the device from commandline with the "-read-only"-Argument - then everything runs fine and fast.
But that's not a solution anyway because it doesn't preserve changes on the emulated device.
Any ideas?
I totally agree with Raman's comment: too much disk write. When I am using the android studio( "version": "dev build","buildNumber":"203.7717.56.2031.7678000",) emulator, the process with highest real time "disk write" value in gnome's system monitor, can reach 40 or 50 MB/s, which is quite astonishing. 40 or 50 MB/s not only in the start or end of emulation, it also happens as long as I make any operation in virtual device(i.e., swiping, clicking, opening apps). (BTW, ubuntu 20.04, ryzen 4800h, 16GB 3200 ddr4 dual channel RAM, emulating pixel 4, android 11 x86 with google play). I am also trying to find out why.
May be you could reduce the "disk write" by disable quickboot snapshot? I disabled automatic snapshot, and take a snapshot manually. Then disabled the quickboot, and set the default boot option from "quickboot" to "boot from one specific saved snapshot". Please remember, after setting the cconfiguration, you must reboot your PC to validate the settings, otherwise the settings may or may not take effect, or you simply could not open emulation unless reboot.
After rebooting, the "disk write" value drops down from 40 or 50 MB/s to a normal range, less than 1 MB/s in most of times. However, after rebooting, I could not read articles from official accounts in wechat app(from tencent company) in emulated android device. The articles are just stuck in loading status after clicking. So this setting may also affect some of normal functionalities.
https://developer.android.com/studio/run/emulator#snapshots
https://developer.android.com/studio/run/emulator#quickboot-troubleshooting
"Loading or saving a snapshot is a memory-intensive operation. If you do not have enough RAM free when a load or save operation begins, the operating system may swap the contents of RAM to the hard disk, which can greatly slow the operation. If you experience very slow snapshot loads or saves, you may be able to speed these operations by freeing RAM. Closing applications that are not essential for your work is a good way to free RAM."
For your description, "But that's not a solution anyway because it doesn't preserve changes on the emulated device." You could simply take a snapshot manually when you need to save, and set it as your boot snapshot.
I noticed it happened quite much for emulated devices with Google Play or Google Api images. Also, after waiting quite a while (let say 10 minutes), the phenomenon stops. What I do is to use, whenever possible, devices with low API levels, then with no Google Play image, and better, no Google Api at all. I also try to allocate quite a lot of ram to the emulated device (at least 3G). It is really astonishing how an emulated Android device with api level 15 is fast compared to a api level 30 or 31.
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
I'm trying to figure out where my memory leak is coming from since lately i'm experiencing a lot of performance drop when just opening a new tab on my browser FireFox ver.51
Just to be sure I've disabled all non-Microsoft startup services in msconfig even after reboot it still gets stuck on this.
Looking up on the vendors updates for this machine then it would be up to date on the drivers, i do occasionally check for Intel Chipset and onboard Graphics drivers (stable versions only) myself that are a few years newer then the vendor.
MS Resource monitor
MS Taskmgr Perfomance monitor
In the Taskmgr Performance monitor you can see I'm barely using any CPU and I/O leaving out any form of I/O wait issues due to swapping.
When looking in the Resource monitor actual physical RAM in is about 6.3GB while Cached is only 1.6GB making it roughly 4GB RAM missing where it's usage is coming from.
So i did do a offline MemTest (oh yes the old blue gorgeous BIOS screen) and all checks were passed, luckily it's only 8GB RAM so the downtime is manage-able ;)
Any ideas or other handy tools I can use to find the culprit?
Already fixed it, seems like my pagefile is storing too much cached memory for some reason, will look into it myself why it stores so much memory
System notes:
1. Using Android Studio 1.1.0
2. Using Windows 8.1, 32 bit
3. Using JDK 7
4. 512mb was given to the emulator and Intel HAXM is installed and in use.
Hello!
My Android Studio emulator memory is being stupid. When I try to run an AVD, it does the normal stuff, then gives me this error message:
The memory needed by this VM exceeds the driver limit.
Cannot set up guest memory 'pc.ram': Invalid argument
I fully understand that it is exceeding my PC RAM, however I can't fix this error as I can't find where to lower the memory allowance. Also, 512mb is the recommended amount, so will lowering the allowance have a bad effect?
Any help will be greatly appreciated.
Thanks in advance!
The memory allocated has to be lower or equal to the memory usage you have set during the installation of HAXM. Relaunch the installation and modify it.
This answer belongs to ph0b from: How to fix: "HAX is not working and emulator runs in emulation mode"
As an Android developer I've been moving away from Eclipse to Intellij IDEA for production code in anticipation of Google's Android studios which shares a code base with IDEA.
My experience has been a good one up to this point. I've only been using IDEA at the office, where I have a 4x core Intel i7 machine running Ubuntu 12.04 LTS (Sun JDK/JRE), up to this point and I've never noticed what the performance of IDEA really is.
Now however after setting IDEA up on my personal computer at home the performance is abysmal. Memory usage is normal, but the constant CPU usage bounces between 80%-100% (over the whole application lifecycle). And that is when nothing else is running on the machine and no work is being done, by me or visually by the IDE.
This makes IDEA unusable when working on it, and I can forget about having anything else running along side it.
My home specs and software are:
Intel Core 2 duo 3GHz
8 GB RAM
Ubuntu 12.04 x64 LTS (3.8.0-35-generic) running of SSD SATA
Intellij IDEA 13.0-0ubuntu1 build: IC-133.193
Tried both OpenJDK and Sun
And the strange thing is that this happens as well with Android Studios.
All help in trying to debug this behaviour would be appreciated.
#Edit 1:
Noticed that the CPU load falls down to 20% when bringing up dialogs (Project structure, Settings, etc) and then goes right back up when dismissing them.
#Edit 2:
I tested simply getting the tarball straight from JetBrains, instead of using the one in Canonical's ppa. The performance was significantly better for at least an hour (20-30% CPU usage while idle). Seems that the native file watcher in C-PPA wasn't working properly and was indexing the whole filesystem.
However the performance became worse after the first hour or so, going back to 90-100% CPU.
The issue turned out to be the native-file watcher being out-of-date. IntelliJ was re indexing my whole drive it seems. Was fixed by uninstalling the version gotten from Canonical's ppa and installing directly from JetBrain's own webpage.
Are you using any plugins outside of the included ones which might cause issues.
I don't run Ubuntu anymore but can't recall any issues with high CPU-usage when i did. (I use Fedora with KDE a colleague uses Fedora with GNOME though. )
Does this always happen or only when you have a project open?
I'm thinking if this might have something to do with the background-compile that IDEA does.
Might be worth trying to turn this off.
Found under Project Settings -> Compiler -> Make Project Automatically
worst case it is a Unity-integration issue or something. Haven't used unity so can't say.
Usualy I manage to fix it by deleting IDE's index files rm -rf ~/.RubyMine60/system,
don't forget to change .RubyMine60 to IDEA's config folder
If you're willing to do some sleuthing, you could run the Oracle JVM and use the VisualVM profiler to see where the IDE is spending all its time, presuming it's a Java-based process that's actually eating your CPU cycles.