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
Related
I am trying to get the Android Emulator to work with my Ryzen 2700X CPU but I always get the following error:
Emulator: qemu-system-x86_64.exe: WHPX: Failed to enable partition extended X64MsrExit and X64CpuidExit hr=80070057
Emulator: qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument.
I made sure the latest Emulator version is installed and Windows Hypervisor, Hyper-V and virtualization in BIOS are all enabled.
I searched for answers for a while but could not find any solution to this problem.
EDIT:
After deleting the Nexus5X device and re-creating it with Pie x86 it worked fine. Make sure to check the following:
activate Visualization in your BIOS (SVM Mode)
Android Studio and Emulator are up-to-date
Windows Hypervisor and Hyper-V-Hypervisor in Windows Features are activated (uncheck Hyper-V-Services)
run Android Studio as Administrator
I think you've done all the setups well.
but
Do you use Windows 1903 version?
That version has an issue for Ryzen CPU Virtualization.
as a solution
You can update the Windows version
Or Revert to the previous version.
Or you can update it to a preview version.
When I try to run my Hello application , the emulator gives this message. What is the sulotion?
This is the emulator view unfortunately.
Error
31/08/2018
16:32 Gradle sync started
16:32 Project setup started
16:32 Gradle sync finished in 3s 187ms (from cached state)
16:34 IDE and Plugin Updates: Android Studio is ready to update.
16:35 * daemon not running; starting now at tcp:5037
16:35 * daemon started successfully
16:35 Executing tasks: [:app:assembleDebug]
16:35 Emulator: emulator: ERROR: x86_64 emulation currently requires
hardware acceleration!
16:35 Emulator: Process finished with exit code 1
16:35 Gradle build finished in 27s 847ms
Boot into bios and enable VTX. This allows the emulator to use hardware virtualization.
As can be seen in your error-output, running an emulator x86_64 emulation currently requires hardware acceleration!.
What does this error mean/where does it come from?
Emulations run in a virtualized thread of your CPU. A CPU normaly got several physical cores (e.g. in QuadCore CPUs there are 4 physical cores). Virtualization furthermore subdivides these cores into multiple "virtual" cores, meaning it simulates more phyisical cores. You can read more information elsewhere on the internet. Here an extract from geek-university which sums it up pretty short to the point:
CPU virtualization involves a single CPU acting as if it were multiple
separate CPUs. The most common reason for doing this is to run multiple different operating systems on one machine. CPU
virtualization emphasizes performance and runs directly on the
available CPUs whenever possible. The underlying physical resources
are used whenever possible and the virtualization layer runs
instructions only as needed to make virtual machines operate as if
they were running directly on a physical machine.
When many virtual machines are running [...], those [...]
might compete for CPU resources. [...].
Emulators need this environment due to the highlighted reason: Its emulating an entire other system - In your case an Android smartphone.
Solution
Regarding you have an Intel-CPU (AMD should be somehow analog), this should solve your problem.
As general note (this seems to be solved in OPs question since its not in the error log): Make sure Intel x86 Emulator Accelerator (HAXM installer) is installed in your Android SDK (check under Settings -> Appearance & Behavior -> System Settings -> Android SDK -> SDK Tools)
Also as note if somebody wants to check if he has OPs problem coming from a more generic error: Run this command in the command line (needs Android SDK Command-line Tools (latest) to be installed in your SDK):
C:\Android\YourApp> C:\Users\{Username}\AppData\Local\Android\Sdk\emulator\emulator.exe -avd YourAVDName -netspeed full -netdelay none
# The First is your path to your SDKs emulator.exe; use the path you installed the SDK in
# -avd needs a name of an existing AVD you set up in the AVD Manager in Android Studio.
The possible outcome is (if HAXM is already installed and hardware acceleration is your poblem):
emulator: Android emulator version 30.5.3.0 (build_id 7196367)
(CL:N/A) handleCpuAcceleration: feature check for hvf emulator: ERROR:
x86_64 emulation currently requires hardware acceleration! CPU
acceleration status: VT feature disabled in BIOS/UEFI More info on
configuring VM acceleration on Windows:
https://developer.android.com/studio/run/emulator-acceleration#vm-windows
General information on acceleration:
https://developer.android.com/studio/run/emulator-acceleration.
Note that I used an AVD with x86_64 here.
To solve the error you have to restart your PC and enter your BIOS. Search for you CPU-preferences (can often be found in an Advanced-options tab). Somewhere there you'll find a setting called Intel Virtualization Technology which presumably is disabled. enable and restart your computer.
Now your AVD should work fine.
7:45 PM Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release.
7:45 PM Emulator: emulator: ERROR: x86 emulation currently requires hardware acceleration!
7:45 PM Emulator: CPU acceleration status: Unable to open HAXM device: ERROR_FILE_NOT_FOUND
7:45 PM Emulator: Process finished with exit code 1
Couple things could be going on here. first off Im assuming you're not running it in some virtual environment so few things you could try
The issue might be your CPU hardware, if you have like a core 2 duo processor or something along the low lines like that then it probably does not support Extended Page Tables and Unrestricted guest(thats your EPT + UG error) try running on an API lower than 21 and see if it works you will still get warnings but it should work if that the case
if that isn't the case see if intel virtualization technology is turn on in your bios
try updating your HAXM(hardware accelerated execution manager) on your computer using resource file from the official site(software.intel.com) or whatever it is
or if you don't even have HAXM you can try installing it....
Installation of Intel HAXM consists of two steps. First, you need to download it using SDK manager. Then you need to run intelhaxm-android.exe to install Intel HAXM
also would help to know what kind of processor/cpu you have
Found a few links for the warnings:
For the first warning: Quick Boot not supported
For the others: HAXM errors
Install HAXM from "...sdkroot/ extras / intel" folder .Open the file 'intelhaxm-android.exe'
from this folder.If you don't have it download it.
Reverting back to 7.1 version of HAXM driver worked for me.
the rest are all warnings, so my Emulator showed up finally!!!
Thank you all for guiding.
This question already has answers here:
Error in launching AVD with AMD processor
(19 answers)
Closed 6 years ago.
I am getting this error when i tired launching the emulator. Any suggestions?
Cannot launch AVD in emulator.
Output:
emulator: WARNING: VM heap size set below hardware specified minimum of 128MB
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: HAXM must be updated (version 1.1.4 < 6.0.1).
After downloading the Intel HAXM from the android studio, you need to install it. Run the setup from Users*name*\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe
Sadly, this can be installed only on computers with Intel CPU's, so you must have an Intel to run the Android Studio emulator.
Have you tried reinstalling Intel HAXM? To do that follow these steps.
1) Open SDK Manager and Download Intel x86 Emulator Accelerator (HAXM installer) if you haven't.
2) Now go to your SDK directory (C:\users\username\AppData\Local\Android\sdk, generally). In this directory Go to extras > intel > Hardware_Accelerated_Execution_Manager and run the file named "intelhaxm-android.exe".
3) Restart Android Studio and then try to start the AVD again.
It might take a minute or 2 to show the emulator window.
See this link
or this (for Windows, see link for Mac/Linux):
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 /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
Note: You must provide an x86-based AVD configuration name, otherwise VM acceleration will not be enabled.
If you are running the emulator from Android Studio, run your Android application with an x86-based AVD:
In Android Studio, click your Android project folder and then select Run > Edit Configurations...
In the left panel of the Run/Debug Configurations dialog, select your Android run configuration or create a new configuration.
Under the Target Device options, select the x86-based AVD you created previously.
Run your Android project using this run configuration.
You can adjust the amount of memory available to the Intel HAXM kernel extension by re-running its installer.
You can stop using the virtualization driver by uninstalling it. Re-run the installer or use the Control Panel to remove the software.
You need to have the latest version on intel haxm driver installed. You seem to have version 1.1.4 and the latest one is 6.0.1
Here is the direct link to download and install https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
enable VT-x for your system, get the latest version of haxm here https://github.com/intel/haxm/releases/tag/v7.4.1 update and u are good to go.
(Or you can use the SDK manager to install it like the other answer suggests)
I'm beginner in android studio and i have installed latest android studio in my pc, which is windows 7.
Now when i try to run emulator it shows, following error.
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!
I've googled and found the solution for it and i've tried to install Hardware_Accelerated_Execution_Manager from the android sdk path.
But when i try to install the exe it shows following error, see
image
I've installed Intel Processor identification, and checked visualization is enabled,
see image
So can any one tell me why emulator is not running in my pc?