Run android emulator x86 using Docker under Mac OS - android

I installed docker.app on the my and I want to start up android x86 emulator in the docker image.
Unfortunately I met the following error(s) while trying to start the emulator. (emulator #nexus7)
ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM requires a CPU that supports vmx or svm
Given my Mac OS actually seems to support vmx, how could I startup android x86 emulator?

The way I've managed to do this (for now) is somewhat convoluted: I've set up an ubuntu vm in Parallels and enabled "nested virtualization"
With that setting I've managed to spin up and run our Android UI tests via docker on a Mac.
I've yet to figure out how to do that without the additional Parallels VM layer.

Related

Running android emulator with Azure windows 10

I am trying to run an android emulator on an azure VM running windows, Windows 10 Pro version 1809 - But I am getting the following error message running the android emulator:
C:\Program Files (x86)\Android\android-sdk\emulator>emulator -AVD androidemulatorapi28
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure the Windows Hypervisor Platform (WHPX) is properly installed and usable.
CPU acceleration status: HAXM is not installed on this machine
The hyper-v is enabled:
And Windows Hypervisor Platform as well:
The size of the VM is D2_v3 and Dv3 - series is supposed to support Nested Virtualization. Here, here and here are claims about it being so and that android emulator functions. And as I far as I have understood:
...is part of Dv3 series.
What could be the problem?
I am able to run an Ubuntu VM in Hyper-V of the Azure Windows VM.
Disabling Hyper-V and Windows Hypervisor Platform, installing HAXM and running I get this error:
According to the writer of this medium article and this StackOverflow discussion - A special custom implementation of OpenGL is necessary - because the particular azure VM size doesn't come with a GPU. However, following the steps of the article I get another type of crash - when using the Mesa3D+LLvmpip version of opengl32.dll from the authors Github repo, replacing the OpenGL file in system32 and running the android emulator:
I found there was a gihub repo - distributing Mesa3D and LLvmpip - downloading mesa3d-19.1.3-release-mingw.exe and running the cmd file:
There is the following message in cmd:
This deployment utility targets systems without working GPUs and any use case
where hardware-accelerated OpenGL is not available. This mainly covers
virtual machines in cloud environments and RDP connections. It can be
used to replace Microsoft Windows inbox OpenGL 1.1 software render
driver with Mesa3D soft pipe, llvmpipe or SWR driver.
...which seems to be a fit for the driver rendering problem.
I was able to git rid of all cmd warnings and error by-avd myandroidemulatorapi28, and any with of following two flags -gpu angle_indirect or -gpu swiftshader_indirect. And set QEMU_AUDIO_DRV=none before running it. The GUI message about the driving issue still comes up and there is a black screen.
According to the owner of the mesa-dist-win GitHub repo - he could reproduce the GUI message diver complaint and still run the emulator successfully - when imitating the state of a VM with his machine.
Note: This is not a solution, this is for sharing details of what I learned after trying out around 10-20 ways:
To enable virtualization in azure VDI, you need to enable Hyper-V feature.
After that you can see in your task manager->Performance that the virtualization is set to true.
If not, try enabling it from command prompt.
bcdedit /set hypervisorlaunchtype auto
After that virtualization is enabled.
Now, you won't be able to install Intel HAXM, as there is a race condition between Hyper-V and Intel HAXM for virtualization.
So, Without Intel HAXM, AVD won't run.
Without Enabling Virtualization with Hyper-V, there will be just black screen in AVD, and it won't boot.
So, I believe there is no solution to this problem until now, I have search everything on google, stackoverflow. If someone finds a solution, please post it over here.
Im facing the same issue with you using Win10 or Windows Server 2019 for DV3 and EV3 series. But I got it working on ubuntu if you are open for that option. No hyper v or haxm required, it is using KVM
Just go to the link "https://github.com/intel/haxm".
Scroll down to find "Downloads".
Download the "haxm-windows_v7_7_1.zip" for windows & haxm-macosx_v7_7_1.zip for macoxs.
Install the package and it will solve the issue.
They is another android emulator that is working
https://www.sanganakauthority.com/2020/04/run-android-emulator-and-android-studio.html

Unable to run Android Emulator using WHPX on Azure VM

I following the guide here:
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin
to run Android Emulator using Windows Hypervisor Technology. I'm currently working on Azure VM D_v3 series. During debug my sample app, I've got this error:
2>emulator: CPU Acceleration: DISABLED
2>emulator: CPU Acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
2>emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
2>Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
2>CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.
WHPX is for sure enabled in Windows Features. Have any idea? Is it possible with azure?
Try disabling OpenGL. It worked for me in a DSv3 VM.
It can be disabled by going to Program Files (or Program Files x86 if you're on a 64-bit machine)\Microsoft XDE\10.0.10586.0\SKUs\Android\xdesku.xml and deleting this line: GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay".
If there are multiple versions under xde, pls identify which version has SKUs\Android.
Ref:
https://social.msdn.microsoft.com/Forums/en-US/d7c0bbc5-eb29-4080-8398-e55111d98c91/vs-android-emulator-cannot-boot?forum=visualstudiogeneral
Today's version of Azure VM may not have full nested virtualization capabilities enabled which may not allow Android emulator on Azure. Dsv3 or Esv3 version machines only have nested virtualization enabled. I tried and could not run Android emulator. While for now you can use Visual Studio Emulator for Android [older version of Android API]on Azure VM. Refer details for step by step guide - https://www.sanganakauthority.com/2020/04/run-android-emulator-and-android-studio.html

Android Studio not launching an emulator

When i am trying to run Android code in Android Studio it shows the following in the event log. But I'm not getting any output and am unable to open the emulator.
Executing tasks: [:app:assembleDebug, :app:assembleDebugAndroidTest]
7:28:43 PM Gradle build finished in 4s 386ms
7:30:24 PM Executing tasks: [:app:assembleDebug]
7:30:27 PM Gradle build finished in 3s 576ms
When I am trying to run from AVD Manager it shows as follows:
Cannot launch AVD in emulator.
Output:
emulator: WARNING: VM heap size set below hardware specified minimum of 384MB
emulator: WARNING: Setting VM heap size to 384MB
emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: Android Emulator requires an Intel processor with VT-x and NX support.
Your CPU: 'AuthenticAMD'
When this type of problem happens, best way is to make sure you have followed below points correctly.
You have proper SDK installed
You have Intel HAXM & virtualization option enabled in your BIOS
Configure emulator correctly, download the Intel X86 Atom system image for better performance.
User arm instead of x86 if you have AMD processor when creating emulator.(In most of case)
When you created your device you should have used arm instead of x86. It must work
I'd recommend using Visual Studios Android Emulator
It is stand-alone, so you dont need Visual Studio to run it, it boots up in seconds, and is more robust then GenyMotions Android Emulator.
Launch your emulator from VS Android emulator, once the OS boots and the homescreen displays run your code and it will give you an option to choose the VS emulator in android studio.
Download latest version of Haxm and enable it in bios (hardware acceleration), on most computers it is basically turned off

Error in Android Studio: "ERROR: x86 emulation currently requires hardware acceleration!"

I started recently using Android Studio and am stuck with this error message:
x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
Any idea how to resolve it?
I did some search on the issue am having and I think it has to do with changing my ANDROID_SDK_ROOT environment variable to the original value, but no clue how to do so.
Not resolveable if you have an AMD processor on Windows, at least as far as I know.
If you have an Intel processor, enable the virtual extensions in your bios (called VT, if available).
If you are on windows also install HAXM via the Android SDK manager. (also install it, the SDK manager will only download it: {SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe)
Disable hyper-V if you are on Windows 8 or above using: dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Genymotion is an alternative for AMD users.
Possible duplicate of Error in launching AVD with AMD processor

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