Android Emulator freezes every 3 seconds - android

I'm trying to run the Android SDK AVD Emulator on my Windows 10 Machine with an i7-6700K and a Geforce GTX 970. I activated Host GPU and Intel HAXM is operational as well. Performance looks generally good, but for a reason that eludes me the emulator hangs every 3-4 Seconds for about a second, then continues normally. As the effect is hard to describe accurately, I made a short video to illustrate the effect:
https://youtu.be/Dl1pxTRIu_c
As I tried to show in the video, even the virtual keyboard below the actual phone emulation is affected by this "hanging". I already tried deactivating my virus scanner (Avira Free), with no effect. There is also nothing running in the background using too much CPU resources (or, any at all, according to the Windows Taskmanager, the system is jumping between about 6% and 15%). Neither using another SDK image nor another device or resolution seemed to help either.
Any help in improving this is greatly appreciated, thank you!

Install Intel HAXM from android sdk it speed ups android emulator
For more check out this link
Why is the Android emulator so slow? How can we speed up the Android emulator?

Related

Android Emulator laggy even with all optimizations

HAXM Enabled version 7.1.0 and i verified that it's working when the emulator is running
The emulator is using the Nvidia GPU however it's barely using maximum 7% of the GPU at any given time
I have 27.3.1 of Emulator version ( Latest )
Tried x86 image and x86_x64 image
I tried hardware acceleration
I tried software acceleration
I bumped the emulator ram to 4GB (I have 20 GB)
I set the emulator CPU priority to real time
I have NOTHING but Android Studio, and emulator running
The emulator is running horribly slow and laggy and even gives a black screen when going from activity to another
This has been the case since forever
I tried deleting the entire Android SDK and installing from scratch
I have intel virtual technology enabled in BIOS
I tried Google Apis vs none Google Apis emulators
I tried Nexus 5, X, Pixel 1, 2, XL with android P, O, 16 and all laggy
This is what helped me with my Android 9 emulator:
Use Google Play x86 image instead of Google API x86 image, because the former had a notification "Preparing for setup.." which never finished.
After launching the emulator first time, going through the initial google device setting (skipping what can be skipped..) and setting up the SD card (as an external storage).
If there are some app updates running, wait for it and then force quit 'Google play services' app. If the emulator will be slow again after reboot, you might want to do this after every launch.
Disable mobile data in settings, because it was trying to connect again and again, using up all CPU. And CPU helps with rendering, so if there is no available CPU, it gets slow.
Edit:
5. Go to emulator Settings/Advanced and set OpenGL ES rendered to Desktop native OpenGL and OpenGl ES API level to Renderer maximum and reboot the emulator. In my case, using autoselect/autodetect had far worse performance.
-- this is a follow up for my comment above (it's too long to be written as a comment) --
then we established that the problem is coming from your compute (or your OS) - If you're using a Laptop make sure to check the settings of the laptop performance when plugged and when you're using a batterie. In case you have a desktop check also the settings if there is some sort of limitation set by the OS. That can happen to avoid overhitting and loud fan noises. If any of the above doesn't work and you still really wanna figure this problem out and I'll assume you're using Windows 10, then install Ubuntu or any other Linux distribution as a second OS just to try things out. If The problem is solved then you definitely need to change some settings in your windows.
For anyone looking for an answer. I simply updated windows 10 to a newer version and update my graphics card drivers and the emulator is insanely fast again.
I had the same issue on my laptop and also on my high-end PC. I tried everything I could find on the internet:
updating HAXM to the latest version (in SDK Manager)
disabling Hyper-V on Windows
disabling audio in emulator
disabling multi-core feature
changing the renderer
disabling snapshots [1]
Now, I cannot be 100 % sure that anything from above could not somehow contribute to fixing the issue (even that I changed most of it back), but the issue disappeared immediately after I did this:
Go to SDK Manager -> Install the latest SDK Platform
There is said in Android Developers User Guide [1] that these are the requirements for Graphics Acceleration:
SDK Tools: Latest release recommended (version 17 minimum)
SDK Platform: Latest release recommended (Android 4.0.3, Revision 3, minimum)
Even that I did have SDK Platform version 27, for some reason I believe that HW acceleration was not working, cause even moving the emulator windows was laggy (or even its settings). As I said before, latest SDK Platform version seems to be the thing that fixed it.
Also, do not forget to kill all emulator processes and also Android Studio. But maybe restart the whole computer just to be sure (I was doing it a lot, cause I was also checking a bios virtualization settings few times).
If it won't work for you, try turn off the snapshots as that was the last before I tried this. You will have to wipe the data from that image, or even better - create a new AVD and download the latest image from "Recommended" tab.
Hope this will be helpful to someone as I did spend several frustrating hours fixing it (after few months of living with it).
Disabling mobile data is one way that works if you're not connected already to data (regardless of wifi connection), another debugging tool that could help you is the FPS Meter in the Debugging Options in Android, relevant github guide
If your emulator is SUDDENLY slow, this might be the reason:
I ran through the same issue.
I then realized that it was a picture quality issue.
So if you're using a lot of pictures in your app, it will run slow unless you 'lower the picture quality'.
You can use http://compressimage.toolur.com/ to reduce your image quality.

Is there any possible way to speed up the Android Emulator

I'm using a Windows 10 machine with Intel Core 2.20 GHz processor (x64-based processor) and 8.00 GB of RAM and I've assigned 2048 Mb of RAM to the emulator.
So, in my understanding the machine is not that bad to run the emulator quickly. But, emulator response time is too long and also utilizing 80% of CPU, 95% of Memory and 100% of Disk.
Also, tried to assign less RAM from AVD manager to the same emulator but still the same issue and sometimes only white screen is appearing on the android emulator. I have android studio 2.3.3 and already tried to enable/disable the "Instant Run" from the settings but no success at all.
So, is there any possible way to fix this issue, or at least want to know why speed/performance of an android emulator is too slow instead of some external emulator such as Genymotion.
I've spent days on internet and on stack overflow but couldn't find a similar issue/solution and didn't understand the reason of slow performance of android emulator.
You can use Nox Player App and use it like hardware device. You will be able to debug your code as well.

Android Emulator slugish performance

I have intel i7 quad core with 4GB of ram but when I try to run my app on the emulator, God it takes a hell lot of time. Some times more than 5 minutes. I am not emulating any game or graphics intensive thing. I am learning android so just trying simple aps but still it is very slow. Moreover today I found this emulator has stop playing any music or sound I used the in the programs, I made previously. What can be the reason of this weird behaviour and slow speed.
How can I fix it? I am on Windows 7
PS: when I try to type in an app from user keyboard, the emulator doesn't take any input unless I use the emulator keyboard. Can I change its settings to take input from keyboard.
Regards
Open android sdk manager, in extras, install "Intel Hardware Accelerated Execution Manager", and use x86 images (there are two available, one 2.3.3, one 4.0.3) provided by intel.
On windows, android SDK Manager only downloads the installer of IntelHaxm, so you have to go in and install it yourself. Usually you can find it under
android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager and install IntelHaxm.exe as admin.
4GB of RAM imho is not enough, windows 7 and eclipse together takes more than 2GB out on my system. 8GB is minimum and the more the better.
The emulator has always painfully slow for me; I've never gotten any of the standard speed suggestions to work. However, if you have a device available, testing directly on it is much, much faster.

Android SDK running slow

I have installed Android SDK on my computer. I have a intel i7-2600 processor and a Zotaxc 460 gtx fermi and 12 gb of ram. Basically saying, it shouldn't be running slow. Any suggestions on how to speed up the apis? or is it just slow?
Assuming you are referring to the Emulator and not Eclipse or something, you can speed up the Emulator a bit by choosing a smaller screen size for the virtual device, like HVGA instead of WVGA, etc. But that only goes so far. The emulator is just not very fast right now. They are working on it, however. I believe they show some of their early work in this Google I/O session.
If you mean the AVD (the android device emulator) is running slowly, then it is behaving as expected. Perhaps you have an android device you can plug in and run your app on? I would recommend you download developer drivers for whatever device your using instead of the bloated ones they try to get you to download.
Good luck.
Here is some usefull question that is about speed of android emulator:
Why is the Android emulator so slow? How can we speed up the Android emulator?
Eclipse performance can by improved by setting eclipse.ini. For example I have set -Xms512m
-Xmx2048m. Without this options, Eclipse has too few memory to open my project.
Disable the boot animation with -no-boot-anim, "Disabling the boot animation can speed the startup time for the emulator."

Android emulator uses 100% cpu even if nothing i running on it ?

I have a celeron processor :/ and android emulator on eclipse uses 100% of cpu and hangs everything unless I kill it . I was just trying a hello android program from a book and don`t know much about android or even eclipse .I have the android-eclipseplugin installled .
Can someone help me with is ?thanks!
As others have said, the solution is disabling sound. Unfortunately, in recent Android Studio releases (I'm using 1.4) the option to disable sound has been removed from the GUI. To disable sound you can do it either by launching the emulator from the command line with the -noaudio flag, or by editing the AVD's config file and setting the following parameters:
hw.audioInput=no
hw.audioOutput=no
On Linux, I found that file at ~/.android/avd/myAVD.avd/config.ini
I've had the exact same problem and found a solution that works for me.
In the config of the AVD I've set an extra flag "Audio playback support" to "no".
I've also made sure the AVD has 1GB of RAM.
This worked for me.
For me, it was unchecking the Multi-Core CPU check box
Niels' answer worked well for me https://stackoverflow.com/a/7706018
in that the emulator stopped using 100% CPU (dropped down to 10-15%)
Furthermore it had another useful "side effect". I noticed that playing video in Totem or music in RhythmBox would block while the emulator was running. VLC would play video but refuse to play the accompanying soundtrack for the video.
As soon as the emulator was killed, music would start playing.
Niels' answer to set "Audio playback support" to "no" prevents this issue.
I am running Ubuntu 11.04 and Android emulator version 13.0 (build_id OPENMASTER-172639).
I had same issue on my macOS High Sierra and for me helps to create new AVD device and choose CPU/ABI = x86_64, not x86 in Android version dialog. Hope that helps.
The Android emulator is emulating an ARM CPU without hardware acceleration which can be pretty slow even on a core2duo for example.
You can try to reduce the screen resolution of the virtual device which should result in a small performance increase.
The emulator is notoriously slow to start; it can take 15 minutes or longer on an underpowered machine. You can speed start-up a bit by passing the -no-boot-anim to the emulator start-up command. Other emulator options are described here. Also, some AVDs start faster than others. Try creating an AVD with the lowest level SDK that is useful for you.
Once the emulator has started, you don't need to shut it down. When an app exits (or crashes, or whatever), you can just run it again.
One alternative that worths mentioning is Genymotion. It's an android emulator based on VirtualBox, with pre-created images. It supports some features the stock Android emulator isn't very good at, like Wifi 3G, Bluetooth, GPS (with a fancy Google Maps integration, so you don't have to find coordinates manually), multiple screens, etc.
It worth giving it a try at http://www.genymotion.com/
I had this issue running the emulator on Ubuntu 14.04. Disabling the audio does bring down the CPU usage, but in case you need audio to work, it can be fixed by adding a symlink:
sudo ln -s /usr/lib/x86_64-linux-gnu/libpulse.so.0 /usr/lib/x86_64-linux-gnu/libpulse.so
The reason for this is that the emulator tries to use pulseaudio as the backend, but will be unable to link to libpulse.so, which does not exist on Ubuntu (unless you installed the libpulse-dev package). Then it will fall back to ALSA, which constantly calls poll, causing 100% CPU usage.
A fix for the emulator is coming, but for now, adding the symlink solves the issue.
I strongly recommend not to use android emulator. Use VirtualBox + android x86 OS (you can download it here ), and you will get real perfomance increase.
Unfortunately, as far as i remember, it is not from google and it supports only Android 2.2. I really do not understand, why google is not going to make simulator as fast as iPhone simulator , or to make official x86 release for debugging. I do not need emulating ARM processor instructions and I think 99% developers do no need it too.

Categories

Resources