Android Emulator is very slow only if Android Studio is opened - performance

Actually in this case all system is quite slow but the emulator is extremely slow.
Hardware acceleration is enabled, emulator works just fine if I close Android Studio.
The OS is Ubuntu 18.04
Any ideas how to fix this?
P.S. I did read all recommendations regarding emulator performance and it works fine until I start Android Studio.

Go to Tools > AVD Manager > Edit a specific Device > show Advanced Settings >
1. reduce RAM
2. Make sure your using Quick Boot
3. Enable Multi-Core CPU

For me it was completely different I was getting some data from a node server which I forgot to start. The php was delivering the date so could not see the problem on UI. Just started the node server and it was fixed.
Check all server side starts.

In my case (Ubuntu 20.04, Nvidia GPU) it was hardware rendering not being auto-enabled, so I had to manually enable. After that the emulator was very smooth.
Device Manager > find your device > Edit > Emulated Performance / Graphics > Hardware - GLES 2.0

Related

Visual Studio 2019 IDE Performance

I'm using Visual Studio 2019 on my Laptop that is connected to an external monitor. Both my laptop and the external monitor have a 4k resolution.
I'm facing a weird performance issue, where after every click/right-click the whole UI freezes for a couple of seconds. For eg. if I right click on a project, the UI completely freezes, not even the mouse moves and after 1-2 seconds I see the context menu.
My laptop is new and this happens only with VS 2019 and only when my laptop is connected to an external 4k monitor.
Anyone else faced a similar problem or knows a solution for this?
My Laptop has the following configuration:
Intel i7-10750H 2.60GHz
16GB RAM
SK Hynix PC601 M.2 SSD
GTX 1650 Ti Graphics Card
After a little digging, I found these options in Visual Studio. Turning them off seemed to do the trick:
Tools > Options and then under Environment > General deselect the following options:
Automatically adjust visual experience based on client performance
Use hardware graphics acceleration if available
If you want to go one step further, you could also disable the following option along with those above. (but in my case, just disabling those two seemed to suffice)
Enable rich client visual experience
Here's the GPU usage before and after disabling the options (for similar UI inputs).
Before:
After:
In the Before picture, the duration for which the GPU 3D usage remained consistently high is when the UI froze.
What I still don't seem to understand is why VS would need so much of GPU 3D computational power.

Got Android Studio installation error

I am kinda new to Android Studio & stuff. So today, I was installing the Android Studio with the SDK Manager. All was going smooth until an error came up which says:
Unable to install Intel HAXM
Your CPU does not support required features (VT-x or SVM).
Unfortunately, your computer does not support hardware accelerated virtualization.
Here are some of your options:
Use a physical device for testing
Develop on a Windows/OSX computer with an Intel processor that
supports VT-x and NX
Develop on a Linux computer that supports VT-x or SVM
Use an Android Virtual Device based on an ARM system image (This
is 10x slower than hardware accelerated virtualization)
I've attached a pic of my system specs. Can someone please throw some light on this issue?
Thanks
It is because you had not intialize virtual technology in your device.You Need to go in BOOT Option before starting WINDOWS OS and enable VT-x from there>
The option of enabling Virtual technology is putted in different option depends on device manufacturer
Edit: Android Studio emulator won't run on Windows with an AMD processor. The error message is kind of misleading, as it suggests the problem is with your CPU. But it is within the troubleshoot message: "Windows/OSX computer with an Intel processor". Basicallly, that means it is not going to work properly in your current setup. Either try installing Linux and running Android Studio on that (which might come with its own issues), using a physical device for testing or use the slow ARM images.
You are using an AMD processor. SVM is AMD technology and VT-x is Intel technology. So you won't be able to get VT-x to run, but SVM might be possible.
As another poster had suggested, virtualization may have been disabled in the BIOS. There may be an option to enable virtualization. It does however seem to happen that virtualization is activated in the BIOS and Android-Studio does not recognize that. I have not figured out how to fix that either.
You could use the emulator with an ARM image, which will be very slow. Alternatively, you could use another emulator that is not integrated into Android-Studio.

High CPU usage with Android emulator (qemu-system-i386.exe)

The emulator qemu-system-i386.exe cpu usage almost constantly running between 7~9
Android studio 2.1
Android SDK Tools: 25.1.3
Host Operating System: Windows 7 - i7 2630QM - 8GB Ram
Intel x86 Atom System Image installed
No matter what setting i change in the emulator like: emulated performance, multi-core CPU, x86-64 image, always the same thing
It is really annoying fan always on
Anyone had a fix for this issue?
The cause of the constant CPU usage could be the sound. If you do not need sound in your emulator you can disable it by editing the AVD's config file.
Change/add those two lines
hw.audioInput=no
hw.audioOutput=no
Update: As buncis commented you can also try to disable GPS if not needed:
hw.GPS = no
On Linux/Mac the file is located at ~/.android/avd/<AVD_Name>.avd/config.ini
On Windows the file is located at C:\Users\<username>\.android\avd\<AVD_Name>.avd\config.ini
On Mac I noticed that the emulator was using over 100% CPU after my laptop went to sleep. Turning the audio off as Benjamin suggested didn't fix that problem.
Restarting the simulated device by long-pressing the power button on the emulator works for me.
Using the x86_64 (Or the 64 bit) emulator solved it for me. They recommend the x86 version, but it was acting up for me.
To find out what on the virtual device is using the most CPU:
adb shell
$ top
This will show you a list of processes with the highest CPU usage atop.
This will help you determine whether it's a process (such as your app) inside the emulator, another process inside the emulator, or just the emulation itself using a lot of CPU.
In the latter case, try optimizing the emulator by installing HAX (Native intel instructions) or perhaps enable hardware acceleration using the AVD profile editor.
I had that problem on the start of November 2018.
Virtual device was contently trying to connect to the mobile network data, so I turned it off inside of the device itself.
Work great now.
The same problem with qemu on Win7, HAXM 7.2.0. I've tried switch off audio, it didn't help, qemu consumes about 20% of CPU anytime, Android works very slow on both x86 and x64 images.
I've found solutions in HAXM's Release Notes file:
On Windows, Avast Antivirus may interfere with HAXM and cause Android Emulator or QEMU to run very slowly. A workaround is to uncheck "Use nested virtualization where available" in Avast Settings > Troubleshooting.
I have Avast Pro Antivirus 18.5. I've unchecked this param, rebooted PC and now qemu consumes 0% in idle, Android works fine.
UPDATE: if QEMU started consume CPU again, first check Avast's update status. After background update Avast may start to interfere to HAXM again. Just reboot Windows to solve it.
In my case using hardware graphic solved my problem.
my case, coz I choose software for graphics rendering in adv. so after a change to the hardware reduce CPU usage from 60 to 10, and CPU temp from 70 to 40.
I am on macOS Catalina(Version 10.15.2) with Intel Core i9 and 16 GB RAM and Radeon Pro 560X 4GB Graphics.
I solved high CPU usage by qemu by restarting the emulated device using the emulated power button.
Also, while creating the AVD, I chose Hardware Graphics Renderer instead of Auto.
Using kind of old Android version I used Lollipop Galaxy Nexus API 22 dropped CPU usage from 220% to around 30% ! ...
I also switched: Emulated Performance > Graphics > Hardware
Using Android Api 25 ... Hardware for graphics and turning off AVD audio and GPS didn't work for me...
Platform: MacOS
I reduced the CPU usage of my emulator by setting the framerate of the monitor to 60hz. It was on 144hz and my CPU was running at 60% - 70%. By only changing the framerate of the monitor, it's now sitting at 3% usage.
I wasn't able to shut the audio off with the config.ini file, but only with the -noaudio cmd line argument to qemu. However, with Android Studio 3.2, you can't add custom arguments to the emulator, so I made this:
In the emulator dir of the Android SDK, in my case ~/Android/Sdk/emulator/
mv emulator emulator.orig
Make a bash script called emulator with the content:
#!/bin/bash
DIR=`dirname "$0"`
$DIR/emulator.orig -noaudio $*
Then:
chmod +x emulator
Now, the argument -noaudio will be added to all invocations of emulator from Android Studio and will save you a lot of CPU cycles.
I solved it by cancelling "Auto-save current state to Quickboot"
Snapshots -> Settings -> Auto-save current state to Quickboot - NO
I had the same issue recently on Windows 10 (18363): the AVD used all of the host's 16 Threads at 100%, it seems the android.hardware.graphics.composer#2.1-service process on the AVD was to blame.
What helped in my case: going to AVD settings - Advanced - change the OpenGL ES renderer to Desktop native OpenGL and restart the AVD. Now it uses like 2-3% of my CPU resources. Hope this helps someone.
Update:
I have installed Genymotion plugin at genymotion.com/plugins, and it has an amazing performance
In my case, I only encountered this issue when running multiple instances of the emulator.
Re-run the Intel Hardware Accelerated Execution Manager (HAXM) installer provided in the Android SDK (<Android SDK path>\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe), select Change, and see how much memory is allocated to HAXM. If it's 2 GB or less, you probably want to raise it to at least 4 GB. Then restart your emulator and see if the CPU usage drops.
Disable location in settings and also disable touch sounds.
In my case it was the fast boot that was causing the problem, to force into normal boot open the text file in C:\Users\<username>\.android\avd\<AVD name>\config.ini and change at least one of the values.
for example change the line
hw.battery=yes
to
hw.battery=no
In my case it was Airplane mode, when turned ON the CPU usage jumped to 99%:
adb shell
$ top
The issue was noticed on Android 10.0 x86.
If you turn Airplane Mode OFF then the CPU usage should return to normal.
Changing the resolution worked form me. I was using 1440 x 2560 560 dpi Oreo 8.1. Now im using M-DPI Oreo 8.1
For me I turned WIFI off and I dropped from 112% usage to 10%. I would recommend doing this
Just do
$adb shell
$top
Look the PID which high CPU
$kill -9 <PID>
on api31&32: do EDIT each AVD config with Show Advanced Settings and be sure to:
Multi-Core CPU > max (<=> hw.cpu.ncore=8,
4/cores is not enough and may overheat cpu strongly)
Graphics > Hardware (GLES 2.0)
No-SDCard (<=> hw.sdCard=no)

Android Emulator tried with RAM Sizes

Please help me.
I have installed Andoird in my 16GB Ram, I5 Processor laptop.
Everything went well but Emulator is never starting.
I tried with different RAM sizes like 1536,950,512,700,600,800,1100,450,1450.
None worked.I am using CPU/ABI in X86_64, a shown below. Can you please suggest me something.
AVD setup
Thanks
"I have installed Andoird", sounds like you want to use emulator for some other use than for development, if so than Android Emulator isn't that good as it is. If you're using it for development usage, then try to update the system images for API level 23
- the emulator may take upto 10 (or more) minutes to start
-confirm that emulator is running in Task manager,
also , API level 23 is quite new so It may contain bugs that are not known.

Unable to create the virtual machine

I was so happy today that I have been finally able to install Windows Phone 8 SDK and try it a bit. I installed fresh new installation of Windows 8 Pro into my virtual machine (I am running if from Parallels) and then installed Windows Phone 8 SDK.
Everything went smooth, Visual Studio Express is installed and running, but when I created new project and tried to deploy it, VS fails with really weird message.
First of all, message box informing that "The Windows Phone Emulator wasn't able to create the virtual machine: Generic failure" appears. Really informing, really professional - generic error, that's really good. Then the information that deployment failed appears (thanks a lot for keeping me informed about that, I didn't noticed that it crashed completely). And then in the Error List, there is an information about "Invalid pointer" - even better. No clue at all about what failed or what's wrong.
Can anybody help me with that? There is nothing on the internet about this topic so far and I don't know where the problem is. I scanned the Windows events and logs, but there is nothing (probably I haven't been searching properly, so please guide me through that if you can).
Anybody can help?
The Windows Phone 8 emulator requires hardware Hyper-V support. In particular, it requires second-level address translation, hardware assisted virtualization, and hardware DEP support enabled and to not be ran in a hypervisor(no nesting). If you bought your machine within the past 4 years you should have no problem with these requirements. You can check out this article to see more information about that and how to find if your PC supports it.
Because of these hardware requirements, this means you can't run the phone emulator inside of most virtualization technologies... With one exception: I've been using VMWare 9 which appears to include an "unsupported" feature to allow Hyper-V to work though.. So your only choice for running the phone emulator is to either buy VMWare 9 (or 8 with more configuration) or upgrade a physical machine to Windows 8
The unsupported way VMWare allows you to run Hyper-V inside of a VM is that there is a manual option (hypervisor.cpuid.v0 = “FALSE”) which basically tells VMWare not to report to the virtual machine that it's running in a VM. Hyper-V checks if it's running in a VM and won't work if it is, so this gets Hyper-V to work past that check. I personally have tested this whole nested-VM thing with the Phone emulator(including before public release), and other than being quite slow, it does work pretty well with no immediate crashes or anything.
There is a workaround for VMWare Workstation 8 as well in an answer below. However, 9 is much easier to configure, so if you have it use this method.
I ran into the same issue and I fixed it by enabling Hypervisor applications in this virtual machine and adding the following line to the .vmx file:
hypervisor.cpuid.v0 = "FALSE"
This got the emulator working just fine. I found this answer here.
Hope this helps.
Actually, it works quite nicely with VMware Fusion 5.0.1
All I had to do is to add to the .vmx file of the virtual machine the following lines:
hypervisor.cpuid.v0 = “FALSE”
vhv.enable = "true"
Save and restart VMWARE (obviously the VM must be stopped before the changes are made)
I'm right now debugging a test app from VS2012 using the emaulator inside a VM in my Macbook
I'm a happy camper
:-)
I posted the same question on Parallels forum.
Reply:
The emulator is actually a virtual machine, so we are talking about a vm inside a vm, this requires support for nested Hyper-V, which afaik is planned but not implemented yet, also VMWare Fusion already supports this, if you are so desperate.
————-
See Parallels forum post: http://forum.parallels.com/showthread.php?p=646448#post646448
This works for me
Set RAM to 4g
Set at least 2 cores
add to vmx file.
vhv.enable = "TRUE"
hypervisor.cpuid.v0="FALSE"
Goot article
http://social.msdn.microsoft.com/Forums/en-US/wptools/thread/ed72010c-321c-4667-97b2-3ff1540e7f87/
You need SLAT compatible hardware to run Hyper-V, which is a requirement for using the emulator.
Can you clarify what kind of hardware you're attempting to run this on, and if you have enabled Virtualization in your BIOS settings?
The "Invalid pointer" error just means it cannot connect to the emulator (and/or device).
Just as an addition to https://stackoverflow.com/a/13163762/1964969 (top answer at the moment):
manually appending "hypervisor.cpuid.v0" key works for VmWare Player 5 as well (the main reason - this software is free for non-commercial use so it's perfect product if you test the waters, just download from VmWare website and install, it's fully-functional).
Slightly unexpected, any of the following amends solve the problem with WP8 emulator:
hypervisor.cpuid.v0="FALSE"
hypervisor.cpuid.v0="TRUE"
hypervisor.cpuid.v0=""
Yeah, you can apply empty value for that key - but why? Have no idea but it works. I did some notes in my blog as well:
http://windowsasusual.blogspot.ru/2013/01/how-to-launch-windows-phone-8-emulator.html
Under Parallels Desktop 8 follow this guide: http://kb.parallels.com/en/115211
Edit:
Oh, I didn't noticed that you are trying to run emulator on VM. My answer is for non-VM environment.
First of all, you need to check hardware requirement at here
Be careful, successful installation of SDK does not guarantee "your hardware is compatible"
If your hardware is compatible and Hyper-V is running(described in the link above), please check your BIOS and be sure to enable hardware virtualization in CPU Configuration
(for me, I could find it at Booting > BIOS > Advanced > Advanced > CPU Configuration)
Brief summary:
64bit CPU and OS
4GB RAM
Hardware-assisted virtualization supported CPU
Second Level Address Translation (SLAT) supported hardware
Hardware-based Data Execution Prevention (DEP) supported hardware
Proper BIOS settings
For me the solution adding line:
hypervisor.cpuid.v0 = "FALSE"
I use VMware Player and added the line (hypervisor.cpuid.v0 = "FALSE")in the .vmx file.
My virtual machine with Windows 8 Pro runs the emulator for Windows Phone 8 perfectly.
Solved the problem by uninstalling an older VPN client from the machine. It turns out some VPN clients might have compatibility issues with Windows 8. After uninstalling VPN client I was able to run the emulator without issues (of course after making sure Hyper-V was installed and enabled on the machine)
Not enough rep. to comment on the accepted answer, but Microsoft provide instructions specifically for Fusion here. It worked for me, after a couple of reboots of both Mac and VM. I installed W8.1 without Hyper-V support initially and had to install it after the fact ("Turn Windows Features On or Off" in Control Panel), but apart from that no problems. Quite speedy on a 16Gb 2013 MBP.

Resources