Emulator does not open up when running program in Android Studio - android

Overview
I went to run my program in Android Studio using an emulator, but after I completed the process, the emulator would not open up. Several errors were shown in the Event Log when I tried to run it.
Errors
7:41 PM Emulator: Incompatible HAX module version 3, requires minimum version 4
7:41 PM Emulator: No accelerator found.
7:41 PM Emulator: failed to initialize HAX: Invalid argument
7:41 PM Emulator: Process finished with exit code 0
Images
There were several errors in the Event Log as shown in the image.

Download a minimum version of 4 (currently, it is 3) or goto:
SDK manager > Extras > Intel x86 emulator accelerator (HAXM installer) and update to the latest version.
This happens because it needs a minimum version of 4 but you already installed version 3 so, updating will solve the issue.

Related

Android emulator is not working in Android studio

I'm getting this error:
12:53 PM Emulator: C:\Users\tenni\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: error while loading state for instance 0x0 of device 'goldfish_pipe'
12:53 PM Emulator: deleteSnapshot: for default_boot
12:53 PM Emulator: Process finished with exit code 0
I have looked for similar posts on this website and tried updating HAXM to the latest version, and created a new virtual device, but that has not fixed the problem.
Maybe Android studio is not using the latest HAXM I installed?
I'm very new to using Android studio and developing apps so any help would be appreciated!
EDIT
Here's a picture of the version of my HAXM by going to settings > appearance and behavior > system settings > android sdk > sdk tools
This is a known bug and is fixed in the latest version of android studio.
https://issuetracker.google.com/issues/132481542
You can also try a work around by by changing the cpu core from 4 to 1.

AVD Emulator is not working in Android Studio

While running the emulator on the android studio, my Event Log:
17:11 Executing tasks: [:app:assembleDebug]
17:11 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.
17:11 Emulator: Warning: requested RAM 1536M too high for your system.
Reducing to maximum supported size 512M
17:11 Emulator:
C:\Users....\AppData\Local\Android\Sdk\emulator\qemu\windows-x86\qemu-system-x86_64.exe:
Could not load library WinHvPlatform.dll.
17:11 Emulator:
C:\Users....\AppData\Local\Android\Sdk\emulator\qemu\windows-x86\qemu-system-x86_64.exe:
failed to initialize WHPX: Function not implemented
17:11 Emulator: Process finished with exit code 0
17:11 Gradle build finished in 2 s 704 ms
All the bold sentence were shown in RED color.
I am getting Notification as:
Emulator:
C:\Users....\AppData\Local\Android\Sdk\emulator\qemu\windows-x86\qemu-system-x86_64.exe:
failed to initialize WHPX: Function not implemented
My SDK Platform:
My SDK Tools:
I tried to solve the issue with reference: https://stackoverflow.com/a/52587220/7678788 (I was unable to change it) so, I took help of https://stackoverflow.com/a/52342344/7678788, but this also didn't solve the issue.
My SDK Platform and SDK Tools are of the latest version.
How to fix this issue?
UPDATE
I have also installed the latest Intel x86 Emulator Accelerator (HAXM) and tried to run the emulator, my Event Log:
19:11 Executing tasks: [:app:assembleDebug]
19:11 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.
19:11 Emulator: Warning: requested RAM 1536M too high for your system.
Reducing to maximum supported size 512M
19:11 Gradle build finished in 8 s 357 ms
19:11 Emulator: Process finished with exit code 0
All the bold sentence were shown in RED color.
While it's true that the emulator (The emulator ONLY) ask 512mb of ram as minimum, that isn't recomendable since your system, the android studio, and background process also take ram, to run android studio i'll suggest having at least 4gb of ram, but if that isn't posible you should try to have at least arround 768mb of free ram before running the emulator.
For reference there are some OS ram usage(all on x64 OS)
Windows 7 : 460mb - 540mb
Windows 8 : 1.8gb - 2.4gb
Windows 10 : 1.5gb - 2.5gb
Try installing the Intel x86 Emulator Accelarator (HAXM) and reboot the device. Make sure the emulator is installed properly and reboot Android Studio.

Emulator not starting after updating to Android Studio

I have updated android studio to 3.0 through standard update channel. After update am not able to start the emulator.
I have tried the following. But nothing worked.
Restart and reinstall HAXM installer.
Restart and reinstall AVD manager.
Start emulator from terminal.
Change the size of RAM to 2GB.
Graphics to Software GLES 2.0
PFB the logs.
At 4:Run
Error while waiting for device: The emulator process for AVD Nexus_5X_API_25 was killed.
AT Gradle Console:
27/10/17
8:42 PM Gradle sync started
8:42 PM Project setup started
8:42 PM Gradle sync finished in 3s 25ms (from cached state)
8:42 PM adb E 10-27 20:42:34 953 34293 usb_osx.cpp:152] Unable to create an interface plug-in (e00002be)
8:43 PM Executing tasks: [:app:assembleDebug]
8:43 PM Emulator: Failed to open vm 7
8:43 PM Emulator: Failed to create HAX VM
8:43 PM Emulator: No accelerator found.
8:43 PM Emulator: failed to initialize HAX: Invalid argument
8:43 PM Emulator: Process finished with exit code 0
8:43 PM Gradle build finished in 19s 741ms
System Config :
Macbook Pro 2016
OS: High Sierra
Build: 3.0, AI-171.4408382, 201710201707,
AI-171.4408382, JRE 1.8.0_152-release-915-b08x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.13 unknown, screens 1680x1050; Retina
I had the same problem. All I did to solve it was updating Android Emulator and Intel x86 Emulator Accelerator under Android SDK Manager > SDK Tools. It started to work again.
Official Solution from Google issue tracker.
SOLUTION A
HVF Solution: Running the emulator on Canary channel 26.1.x (API 25/26 recommended) with Hypervisor.Framework
I implemented this solution and it worked. I am using emulator now on macOS High Sierra.
A1 - If HAXM installed in Android Studio, uninstall it;
Go to SDK Manager > SDK Tools (or Appearance & Behaviour > System
Settings > Android SDK)
Uncheck Intel x86 Emulator Accelerator (HAXM Installer) and Apply.
This will uninstall HAXM.
A2 - You might need to first install HAXM in order to get HVF to work.
Install standalone Intel HAXM as a regular .dmg install. Download from here: https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm
HAXM on OS X keeps on disappearing. For any reason, you can uninstall standalone HAXM installation by
sudo Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh
If above not work.Try
sudo System/Library/Extensions/intelhaxm.kext/Contents/Resources/uninstall.sh
A3 - Check whether your macOS supports Hypervisor.Framework or not:
$ sysctl kern.hv_support
kern.hv_support: 1 (if support =1, if not support = 0) (should
support to implement HVF solution)
A4 - Find the file "advancedFeatures.ini". It may be placed in;
~/.android/advancedFeatures.ini ( Users/<username>/.android/advancedFeatures.ini) or
/Users/<username>/Library/Android/sdk/emulator/lib/advancedFeatures.ini (I found mine here)
A5 - Open "advancedFeatures.ini" with an editor.
Find the line HVF = off. Change off to on; "HVF = on"
A6 - Restart Android Studio if it is open (Restart the computer if necessary). Create and RUN the emulator :) No more HAXM warnings :)
SOLUTION B
I didn't try this solution but several comments claim that it also worked. You can try this also, follow the instructions from here :
https://blog.celogeek.com/201708/672/android-studio-emulator-haxm-on-mac-os-high-serria-10-13/
if solution A and B not Work
enable VTx in your Bios

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

Android emulator startup issues in VirtualBox running Ubuntu

Ubuntu: Desktop 14.04 (64-bit)
VirtualBox: Version 5.0.16 r105871
Android SDK: 24.4.1
I am trying to get Android Emulator running on Ubuntu 14 (Trusty Tahir).
I first downloaded and installed Ubuntu 14 in a new Virtualbox VM.
Downloaded and installed OpenJDK (apt-get openjdk-7-jdk).
Downloaded and untar-ed the android sdk archive.
Navigated to android-sdk-linux/tools/ and ran ./android
Android SDK manager, pulled SDK build revision 19 (for Android 4.x) and 23 (for Android 6).
After all the packages have been downloaded and installed, i launch Android SDK Manager once more, and click Tools > AVD Manager.
Created a new Nexus5 / Google Nexus AVD. Click 'Start'.
This is when I see the following errors:
Starting emulator for AVD 'AspectClass'
pci id for fd 5: 80ee:beef, driver (null)
libGL error: core dri or dri2 extension not found
libGL error: failed to load driver: vboxvideo
pci id for fd 8: 80ee:beef, driver (null)
libGL error: core dri or dri2 extension not found
libGL error: failed to load driver: vboxvideo
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
emulator: WARNING: The -scale flag is obsolete and will be ignored.
My research into a couple of these errors like the core dri/dri2 lead me to resources that indicate this might have something to do with 3D acceleration setting in Virtualbox. This does not apply to my case since I have 3D acceleration setting disabled.
Any help would be appreciated.
1) Make sure u have latest Android Studio 2.0, update java sdk version to 8
2) start emulator from android studio, if any issues. restart ubuntu,
3) go to boot option usually by pressing F12(or)F2, there enable fast virtual machine option and save and exit. Also enable the same option fast virtual mode in Virtual box VM if any.
4) After login start Emulator from Android Studio. Thats it
Android studio 2.0 has so many improvements http://developer.android.com/sdk/index.html

Categories

Resources