Android emulator loads infinitely - android

It seems, it takes place always with Intel x86 image. But my aim of this setting was using Inter HAXM.
I left emulator running on the whole night, but in the morning it still was booting
If I use arm, it works but I want to try HAXM
Any ideas?

It is just very slow, I recommend instead using Genymotion, but if you want to give a try fixing the speed take a look at this great topic: Why is the Android emulator so slow? How can we speed up the Android emulator?
I am pretty sure you will find your answer there.

What are ur configurations? Using host gpu sometime makes it work

Did you get the message
"HAX is working and emulator runs in fast virt mode"
If not, are you sure you installed HAXM? If you just flag it in the SDK Manager, it's not automatically installed.
To verify if HAXM is installed and running use these commands:
Windows (CMD):
sc query intelhaxm
Mac (Terminal):
kextstat | grep intel
You either get a response like this (Mac):
131 0 0xffffff7f8301d000 0x14000 0x14000 com.intel.kext.intelhaxm (1) <7 5 4 3 1>
Or if it's not working, no response.
The installer haxm installer is located in your Android SDK folder
android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager
All the information can be found here:
Windows:
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
Mac:
https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-mac-os-x

Related

Android Studio Emulator is not working on Windows 11 when WSL2 is installed

Setup:
Windows 11 Home 21H2 22000.132
AMD Ryzen 5900X
WSL2
Android studio lastest build (also tried with latest beta)
Problem:
As soon as I install WSL2, the emulator stops working. It's giving the following error message:
C:\Users\gusta\AppData\Local\Android\Sdk\emulator>emulator.exe -avd Android_TV_1080p_API_300
emulator: Android emulator version 30.8.4.0 (build_id 7600983) (CL:N/A)
handleCpuAcceleration: feature check for hvf
added library vulkan-1.dll
Failed to open /qemu.conf, err: 2
C:\Users\gusta\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=c0350005
C:\Users\gusta\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: failed to initialize WHPX: Invalid argument
Using WSL2 at the same time as the android emulator was working before on an Intel i7 4770k processor, but stopped working after a processor upgrade to a AMD Ryzen 5900x and fresh install of Windows 11.
For clarification: I'm not trying to run the emulator from WSL2, I'm trying to run it from Android Studio. When trying to start it from Android Studio it never launches, when trying to run it from the Windows Command Line I get the above error.
The "Failed to open /qemu.conf" is possible to solve by creating that file manually, as explained by this answer. That however doesn't fix the two later errors with WHPX.
I've followed the official instructions on this page (Following the AMD with Hyper-V option WHPX). I think the problem has to do with Hyper-V running which WSL2 is using if I'm not misstaken. But according to the above link it should be possible to run the emulator at the same time as Hyper-V using WHPX. I've also tried using the Android Emulator Hypervisor Driver for AMD processors, which is giving me the exact same result.
Activated Windows features:
Thankful for any help, and please tell me if I need to add more information
Newer Answer
I found and tested in shorter toggle mechanism.
The configuration for Windows Feature:
Windows Subsystem for Linux is installed.
Windows Hypervisor Platform is installed.
Hyper-V is installed.
If you need the Emulator, you only need to turn off Hypervisor + Restart. Run: bcdedit /set hypervisorlaunchtype off
If you need the Docker back, you can run the hypervisor hence disabling Emulator. Run: bcdedit /set hypervisorlaunchtype auto
You need to restart after setting Hypervisor
You cannot run both at the same time. Another forum worth checking in How about running docker? in my older answer below.
Older Answer
I think I solved this issue, tested to run from CMD / Android Studio and ran perfectly as before installing WSL. There are several step we go:
Configuring Windows Feature:
Removed Windows Subsystem for Linux
Removed Windows Hypervisor Platform
Removed Hyper-V
Here is my current setup:
Reverting AVD setup
I know after removing there are some odds because the AVD still get the same error as before and expected to get into WSL. I stumbled and found something when ran:
C:\Users\[NAME]\AppData\Local\Android\Sdk\emulator\emulator-check.exe accel
That command will check the current accel. It explains that the Hypervisor need to be set off and give specific help:
run bcdedit /set hypervisorlaunchtype off.
After running the bcdedit, I restarted and all is reverted. Now I can run emulator both from CMD and Android Studio perfectly.
How about running docker?
Sad truth, yeah you cannot run both pararel. There are several workaround in this forum:
How can I run both Docker and Android Studio Emulator on Windows?
Several option ranging from changing emulator, add & remove docker when in need using above step, created nested vm, etc. My personal choice right now is using another Emulator for the time being and removed docker for the latter.
I finally got this working using this fix (answer number 48). Seems like a valid workaround until windows fixes this issue. I downloaded the compiled version for windows and moved it to my emulator path C:\Users\<username>\AppData\Local\Android\Sdk\emulator. Seems to be versions available for linux and mac as well but I haven't tested those.
This issue is tracked by Google bug https://issuetracker.google.com/issues/202188690
This problem only occurs with AMD processors, I have two systems both with WSL2 and Docker running on the latest Windows 11 (Insider Beta) build. One with an AMD Ryzen 5950 and one with an Intel i7-8086K.
On the Intel system the emulator runs fine with hardware acceleration together with WSL2 and Docker.
On the AMD I run into the same error when running the emulator with hardware acceleration. In the Windows 10 Insider builds before Windows 11 it still worked.
A very similar problem was introduced before in Windows 10 build 10.0.21292
and later fixed in build 21327. (https://github.com/microsoft/WSL/issues/6471) But this problem affected both Intel and AMD.
I haven't tried to turn off the AMD fTPM yet, as this is the only other change apart from updating Windows 10 Insider (dev ring) to Windows 11.
The Android Emulator Hypervisor Driver for AMD processors only works when the Windows Hypervisor is disabled, it's not used for WHPX.
The Windows Feedback is full of reports of this problem, please upvote them.
Android Studio emulator doesn't support run Hyper-V on Windows 11, we can disable Hyper-V to run but if we do that applications which require Hyper-V to run like WSL2, Docker then fail to run.
While waiting Google update Android Studio emulator support Hyper-V we have a workaround solution to run both by using another emulator which support Hyper-V like Bluestack 5 version "Nougat 64 bit (Supports Hyper-V)" at the link below
https://www.bluestacks.com/download.html
If you did all of those steps and still you are facing that emulator termination issue, then please upgrade or download your graphic card drivers and install it. After I installing Windows 11 this issue happened to my android studio emulator. Lot of steps I followed but nothing work. after that I checked my Graphic card drivers and install it. Now emulator working fine...

Android emulator not starting window 10 - too many emulator instances

This might seem to be a duplicate of it seems too many emulator instances are running on this machine. Aborting but that question was asked 5 years ago and nothing in the answers to it have helped me. I really think this is a different situation entirely.
I'm doing something very simple. I installed Visual Studio 2019 with Xamarin and the Android emulator.
I try to start the emulator from the command line and I get...
C:\Program Files (x86)\Android\android-sdk\emulator>emulator.EXE -no-boot-anim -avd VisualStudio_android-25_x86_phone -prop monodroid.avdname=VisualStudio_android-25_x86_phone
Windows Hypervisor Platform accelerator is operational
emulator: ERROR: It seems too many emulator instances are running on this machine. Aborting.
If I add the -verbose switch I get a huge list of messages, none of which seem relevant so I haven't included them.
This is what I know:
Windows Hyper Visor and the Platform features are enabled.
There are no other emulators active on the machine. Ports 5554, etc are not used.
HAXM acceleration is not enabled.
I have plenty of memory and disk on this machine and the emulator is configured for 512MB of memory
Genymotion emulators are not an option...I need to use Hyper V.
Windows version 10.0.17763.678
All patches to Android tools installed.
No special AV installed. Using Windows Defender.
Tried disabling firewall briefly. No help. I've never had any issue with firewall and local machine traffic.
Any ideas?
Ok...I got the emulator running. I'm really not sure what was wrong. I've spent a few days uninstalling, reinstalling, updating and finally the thing is running. To anyone else who has this issue...I feel your pain.
Here are some suggestions:
Get the code running on an actual physical phone. This worked straight away for me. This gave me some confidence that there was nothing wrong with the code or deployment.
Install and run the emulator on another dev box. Again this worked straight away. This gave me confidence there was nothing wrong with the dev box configuration that inherently prevented the emulator from running. Now I could put dev boxes side by side and investigate the divergent behavior. Did not discover any smoking guns this way, but again it built confidence.
Start the emulator directly from the command line using something like this...
c:\Program Files (x86)\Android\android-sdk\emulator>emulator -partition-size 512 -no-boot-anim -verbose -feature WindowsHypervisorPlatform -avd Android_Accelerated_x86_Nougat -prop monodroid.avdname=Android_Accelerated_x86_Nougat
Reboot/restart often. What I failed to detail in my original post is that I am using Xamarin. Long time users of Xamarin know that this stuff is really brittle. It has gotten a lot better in recent years, but this latest experience shows that it is still very tempermental and problems often disappear after restarting VS or rebooting your machine. Really demoralizing.
Good luck!
I have faced the same problem, i disabled the application control from the antivirus software i use and the problem solved the emulator started working properly.The port that the emulator uses is restricted by the application control feature that is enabled in antivirus software so try disabling it and relaunch the emulator.
I turned off Bluetooth in Windows 10 notification area and that helped me.
https://i.stack.imgur.com/7Qo1t.png
I just solved this by turning off windows hypervisor platform in turn windows features on off and restart your computer. When emulator works normally turn on it again.
Happy coding!

Android Studio emulator: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

My android studio emulator not starting. I'm using Android Studio 3.0 on Ubuntu 17.10
Error - Emulator: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I solved it by going into my virtual device's settings and changing "Emulated Performance" from "Automatic" to "Software".
I solved this problem by changing my graphics driver from Software and Updates. Head over to Additional Drivers and Use the proprietary and tested one.
Check if it helps. Thanks
Changing "Emulated Performance" from "Automatic" to "Software" was a temporary solution for me (I am on Linux btw). The simulator would crash in a few seconds.
Instead this did it for me:
cd ~/Development/Android/Sdk/emulator/lib64/
mv libstdc++ libstdc++.bak
credit: https://cialu.net/android-studio-how-to-solve-emulator-libgl-error-on-ubuntu-systems/
I have this problem to Emulated Performance = software doesn't help, because your emulator will be broken and can not be working if your app needs more process...
I have Ubuntu 18 and install my graphics card Nvidia, and it's solved
now
for ubuntu you can try it:
For Nvidia
sudo apt-get install nvidia-352 "nvidia-352 is an EXAMPLE In my Device"
and For AMD
sudo apt-get install fglrx
more details:
enter link description here
When use Linux spatially Debian and Ubuntu after update card graphic driver or etc. this problem happening often.
So you need just reboot your OS
Restarting the computer worked for me.
Changing the Emulated Performance from automatic to software made it work, but at least on Ubuntu, that has a poor performance.
I solved this issue by simply creating a new virtual device.
The problem is in the linux video card, to solve in Ubuntu 18 or derivatives, just go to "Programs and Updates" -> "Additional Drivers" and select the proprietary driver of your video card and then restart the computer. It resolved for me.
I had the same error tried starting emulator. I am installing android studio 3.5 on Ubuntu 18.04 and NVIDIAM GF119. In Software and Updates, under Additional Drivers tab, I chose the proprietary tested driver for my Graphic card. Then the emulator works.
Found everyone's solution was not working for me. Updated video card on linux and still had the issue.
What worked was changing the number of processor cores available to the emulator from 4 to 2.
I tried the other solutions, but this makes sense as I have 8 processor cores and may need to have several emulators open.
My current configuration is shown in the attached image my emulator configuration
This is most likely an issue with your graphics card driver, i would recommend doing a clean re-install of the driver if it doesn't fix itself on reboot.
For flatpak users on linux, i recommend running "flatpak update" in the terminal to update your GPU dependencies for flatpak (it typically breaks if you update your GPU driver and not flatpak GPU libs), this is what resolved the issue for me.
I made this answer because switching to software rendering isn't really a solution, it's more of a dirty workaround, and will only waste your CPU utilization.
I'm using Ubuntu 20.04.2 and driver install solved the problem.
sudo ubuntu-drivers autoinstall
After finishing the install, need to reboot.
reboot
I had the same problem, my emulators were stopping with SEGV. Both on software and hardware graphics. But after looking in journalctl it was apperantly SELinux that was blocking the emulator. Here I used the SELinux troubleshooter to add a bypass and after that the emulator booted fine.
select this update.work for me.
I was getting the same error using intel graphics on ubuntu 20.04 on a lenovo yoga 260.
I tried lots of answers on stack overflow, and none seemed to work. I could not select 'software' from the gui rather than auto. But then I found this page:
https://developer.android.com/studio/run/emulator-acceleration
And I ran this at the command line and it worked. I don't care if it's slow: at least it doesn't crash.
cd ~/Android/Sdk/emulator
./emulator -avd Pixel_2_API_30 -gpu swiftshader_indirect
I solved this issue by changing the permissions for the img files
cd /home/[your_user]/.android/avd/[device_name]_API_[API_version].avd
chgrp libvirt *.img
chmod 766 *.img
In the SDK Manager, under SDK Tools tab, make sure that you've the latest "Android Emulator".

Error after android studio Installation?

I got this problem when installing android studio ? Although the program runs OK ! But what is the use of HAXM, what if I did not enable INTEL VT -x ?
But what is the use of HAXM
It enables the use of the Android x86 emulator images, which run significantly faster than the ARM emulator images.
what if I did not enable INTEL VT -x ?
You will not be able to install or use HAXM. As a result, you will be limited to development using the ARM emulator images, actual Android devices, and possibly third-party emulators (e.g., Genymotion).
You could check if it's already enabled by trying a few commands.
Start with
bcdedit /set hypervisorlaunchtype off
VT-x must be enabled for hypervisor to run, and hypervisor has to be off for HAXM to run so by trying to turn it off, you can possibly do 2 things at once.
You can also try installing HAXM and it will tell you if disabled.
You can also check your CPU capabilities by looking it up at https://ark.intel.com or getting the Intel CPU ID utility at http://www.intel.com/content/www/us/en/support/processors/processor-utilities-and-programs/intel-processor-identification-utility.html
You doesn't have to use AVD which comes with Android Studio, you can try third party AVD, such as Genymotion or Bluestack. Genymotion is the one that I prefer.

Emulator not working in Eclipse

I followed this tutorial to create HelloWorld Android app.
I was able to start the emulator from eclipse.
But nothing seems to happen except this Android logo keeps flashing on.
Has anyone faced this issue ?
You'd better wait about 10-15 (it depends on your computer). But if it doesn't work, try in command prompt:
adb kill-server
adb start-server
If adb is not found, then you should move your directory to the folder, where adb.exe is located, for me it is
C:\Users\Andranik\android-sdks\platform-tools, therefore:
cd C:\Users\Andranik\android-sdks\platform-tools and after this execute upper commands.
This helps me.
It's working.. It is simply super slow ;)
Keep waiting a while longer and it will boot eventually. It helps to choose smaller devices with less ram.
Just a heads up, loading devices like tablets or the newest phones can easily take you 20-30 minutes.
If you planned not to use Google API as target of your emulator then u can use Intel x86 Hardware Accelerator(HAXM). Open your SDK manager then install Extras-->Intel x86 Hardware Accelerator(HAXM).Install it from
sdk_path\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe (Windows)
Then on your emulator configuration choose Intel Atom (x86) as CPU/ABI rather than ARM.
Additionally you can set more ram to your AVD and check Use host GPU to speed up your emulator.

Categories

Resources