Android Emulator very slow on Ubuntu 20.04 - android

My Android emulator runs very slow on my Ubuntu machine. I need it to run faster, because some apps are slowed down so much, that they change their behaviour (they use the camera).
System specs:
-x86_64
-Intel(R) Core(TM) i7-5600U CPU # 2.60 GHz
-20GB Ram
-512Gb HDD
I use Ubuntu 20.04 and Android Studio 4.1.1 (fresh installation).
I use this AVD: Pixel2 1080 x 1920: 420dpi API 28 Android 9.0 (Google X86_ARM) CPU/ABI: x86
In the extended menu I chose Graphics: Hardware - GLES 2.0. I also disabled GPS, audioInput and audioOutput with no performance improvements.
I did not try this, because selecting Hardware - GLES 2.0 worked for me and the avd started normally (but still very slow).
Other system images are equally slow though.
I tried:
sudo modprobe msr
sudo rdmsr 0x3A
and it returns 5, so VT-X is enabled
Is the hardware the bottleneck, or is something configured wrongly? Maybe it is the HDD that slows the emulator down? I tried running the emulator on Windows and it's insanely fast. The windows machine is stronger though.
Update 11.12.2020:
I also verified my KVM installation using this command:
./emulator -avd Pixel2Api28Arm -accel-check
It returned this:
28Arm -accel-check
accel:
0
KVM (version 12) is installed and usable
accel
So this does not seem to be an issue.

I was having the same problem (KVM working, but slow x64 emulator on x64 host), and found a solution here, which is to disable automatic snapshot creation.
Run your emulator, and click on the three dots (...) to open the settings:
In the settings, click "Snapshots":
Switch to the "Settings" section on top:
Set "Auto-save current state to Quickboot" to No:
It'll ask you to restart the emulator, click Yes:

Related

Android Emulator causing Blue Screen

Whenever I am trying to run the Android Emulator (any Nougat, Oreo, or Kitkat) laptop throws a blue screen saying STOP CODE IRQL NOT LESS OR EQUAL.
My laptop will restart in 20 minutes or so and I can do everything else on my laptop and even run the Android app on my mobile using USB Debugging.
I tried reinstalling android studio and AVD manager several times but my issue is not getting resolved.
PLEASE help!
Laptop Configuration:
Dell Inspiron 3576
Processor: Intel(R) Core(TM) i5-8250U CPU # 1.60GHz 1.80 GHz
RAM: 8.00 GB (7.87 GB usable)
System Type: 64-bit operating system, x64-based processor
Edition: Windows 10 Home Single Language
Version: 20H2 (as of 01st April, 2021)
I had the same issue with NoxPlayer which is another android emulator, the stopcode was different but it was fixed when I created a new boot entry with Hyper-V Disabled.
Check this out:
https://blog.nicholasrogoff.com/2013/12/27/create-a-no-hyper-v-boot-option/
"Don't forget to change Windows8 to windows10 in your commands, That's just a name but it has to be meaningful :D"

Black Screen with Android Emulator

I am a newbie to android development and am running Ubuntu Linux with an AMD cpu. I installed Android Studio, JDK, SDK, etc, and have been trying to run the emulator. However, whenever I try launching the emulator, it stays a black screen. The message I repeatedly get in terminal is
WARN - run.EmulatorConnectionListener - Emulator not ready yet, dev.bootcomplete = null
I have tried waiting for a while, I have tried updating it, I have tried different APIs, I have tried setting emulated performance to software, and everything else I could find online. Help would be greatly appreciated!
Specs:
Ubuntu 16.04 LTS
Android Studio 2.3.3
Radeon R9 270x 4gb
AMD FX4100
32g ram
SVM is enabled in BIOS
This happened to me recently (emulator with black screen, with all AVDs, even those which worked previously), maybe after some system or Android SDK updates.
How I fixed it:
delete whole .android directory (is in your home directory) - backup this directory before deleting (it contains your AVDs, your debug signing key or other things you might wish to return to later) - yes, this was the thing that really helped
create new AVD - you have to do this after deleting that .android directory (it did not work if I copied backed up AVD back there)
For reference, here is AVD configuration which works for me now (created directly using Android SDK, not using the wizard in Android Studio):
Device: Nexus One (3.7", 480 x 800: hdpi)
Target: Android 7.0 - API Level 24
CPU/ABI: Intel Atom (x86_64)
Keyboard: [x] Hardware keyboard present
Skin: Skin with dynamic hardware controls
Front Camera: None
Back Camera: None
RAM: 1024
VM Heap: 64
Internal Storage: 200 MiB
SD Card: (empty)
[ ] Snapshot (unchecked)
[ ] Use Host GPU (unchecked)

Android x86 + VirtualBox

I try to install android x86 4.2 (I tried also 4.0 asus laptop and eeepc) to my VirtualBox. My pc configuration:
Windows 7 x64
Lenovo Y570, Intel Core i7
NTFS file system
What I create in VirtualBox:
Name: Android x86
Type: Other (I tried Linux 2.4 x86 or Linux 2.6 x86 too)
Version: Other/Unknow
RAM: 512 Mb
Create a virtual hard drive => VDI (or HDD) => Fixed size (or dynamically) => 3 Gb (or 6)
Than I start my device and see boot menu. If I try to run it without installation, I see
Detecting Android-x86... found at /dev/sr0
Warning: Not an ASUS product
A N D R O I D
and nothing more happens. But now it must run like in different tutorials.
If I install, I try to format my Primary/Logical Bootable/Unbootable disk (FS type is Linux) from Choose Partition => Create/Modify partition.
I see very quickly disappearing line "could not find valid v7 on sda", than I see "can not mount /dev/sda1 Do you want to format it?" And I again go to Choose Partition menu.
Why emulator does not run?
Edited.
Answer: It's just a destiny. I installed VBox on my big pc with Win7 x32 and all is fine. On my Lenovo with the same config but with Win7 x64 it does not work. If u really wanna good android emulator, u can try YouWave.
I have HP430 Laptop with win 7. I had the same problem. But I figured out the solution.
While booting the computer with win7 I entered BIOS menu. There was a option to optimize pc for virtualization.I selected it. After that every thing ran smooth.
Later I noticed in virtual box that, in system settings the acceleration type was VT-x AMD, Nested Paging,PAE/NX. This was different before optimization.
Hope this gives some idea.

Android emulator: how to find out if hardware virtualization feature is used?

Starting with Android SDK Tools rev 17 the Android emulator supports using the hardware virtualization feature (Intel VT, VT-x, vmx and AMD-V, SVM) which should speed-up x86 based emulator images a lot: http://developer.android.com/guide/developing/devices/emulator.html#accel-vm
I installed all necessary components:
The newest SDK tools
The Intel Hardware Accelerated Execution Manager (and installed it by executing IntelHaxm.exe)
Intel Atom x86 System Image (available as API 10 and API 15 image)
Then I created a new AVD using that image, but I could not "feel" any difference regarding the execution speed.
Therefore my question is: How to find out if hardware virtualization feature is used?
And if not what needs to be done to use it?
I know that it is enabled by the BIOS, because I can run Windows 64 bit VMs in VirtualBox.
Additionally I have verified it using the Microsoft® Hardware-Assisted Virtualization Detection Tool.
During emulator loading you should see this line:
[2012-03-26 14:06:22 - Emulator] HAX is working and emulator runs in fast virt mode
After steping through this tutorial on OS X Lion, I see the following in the console, when starting the emulator:
./emulator-x86 -avd Test3
HAX is working and emulator runs in fast virt mode
Had the same issue on Windows 7 32bit with Q6600 Intel processor and pretty outdated Asus P5E-VM SE motherboard.
The motherboard did not even have a switch for virtualization, though Intel tool:
http://www.intel.com/support/processors/tools/piu/sb/CS-014921.htm
indicated that VT technology is enabled.
The culprit was that Data Execution prevention was enabled only for windows services, I have enabled it for all programs and after computer restart received this message in the Android Console of the Eclipse:
HAX is working and emulator runs in fast virt mode
DEP setting is located:
Located Windows/Control Panel/System&Security/System/Advanced System Settings/Advanced tab/Performance/Data Execution Prevention tab
The idea to check it I received here: https://developer.tizen.org/sdk/haxm
Though only used standard images (not Tizen ones).
Have to say that loading of the emulator in the virtualization mode is not nearly as impressive as on Intel promo video: http://www.youtube.com/watch?v=pt9IeJ777zw
But uploading of the application (mine is pretty big ~5MB) and general responsiveness of the emulator is quite significant. One cannot say that it works as native computer (that it sometimes there is a visible lag), but again it is visibly faster.
It eats a lot of memory though (I have 4 GB, only 14MB is free when emulator will run).
A quick solution for Windows platform, Launch CMD as an administrator and type this command
SC query INTELHAXM
And you should see output like this (if hardware acceleration is up and running)
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

How well does the Android Phone Emulator reflect the performance?

I've been playing around with OpenGL ES development on Android. OpenGL ES applications seem to run slowly in the Emulator on my development machine. Does this reflect likely performance of actual hardware? I'm concerned about spending too much time developing an application if the graphics performance is going to be sluggish.
The emulator is super slow on my Mobile Intel Pentium M 725, 1600 MHz.
I'm assuming the emulator isn't representative of real world performance.
Emulator is soo slow ,that in some cases an openGL application wouldn't even start when using it.
While the actual hardware of android can even be so strong,that you can even play GTA on it.
Configuring VM Acceleration on Windows
Virtual machine acceleration for Windows requires the installation of the Intel Hardware Accelerated Execution Manager (Intel HAXM). The software requires an Intel CPU with Virtualization Technology (VT) support and one of the following operating systems:
Windows 7 (32/64-bit)
Windows Vista (32/64-bit)
Windows XP (32-bit only)
To install the virtualization driver:
Start the Android SDK Manager, select Extras and then select Intel Hardware Accelerated Execution Manager.
After the download completes, execute <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.exe
Follow the on-screen instructions to complete installation.
After installation completes, confirm that the virtualization driver is operating correctly by opening a command prompt window and running the following command:
sc query intelhaxm
You should see a status message including the following information:
SERVICE_NAME: intelhaxm
...
STATE : 4 RUNNING
...
To run an x86-based emulator with VM acceleration:
If you are running the emulator from the command line, just specify an x86-based AVD:
emulator -avd <avd_name>
After the new update the emulators have become much more reliable but still can't be taken as the way to check the performance of your application. Till now testing the application of real devices are more reliable then emulators.
With the new emulator of Android Studio 2.0, if you have good computer it runs quite smoothly, at leat for my application!
Check the features!

Categories

Resources