Unable to create a virtual device: Unable to create Android virtual device - android-studio

While installing Android studio 2.1 version and it downloaded the required components and end of the detailed view logs it shows,
Android SDK is up to date.
Running Intel® HAXM installer
Intel HAXM installed successfully!
Creating Android virtual device
Unable to create a virtual device: Unable to create Android virtual device
I'm running Android studio for the first time in Windows 7.
Screenshot:
And after opening the Andriod studio and running a sample app, I get the error
Error while waiting for device: Could not start AVD
Why is it unable to create a virtual device and how can I solve the problem?

All what you can do with that screen is just to click finish.
The problem that you may get as a result is failing in creating a first Virtual Device for you because its config file is either missing (not created) or corrupted !
So what you would do is just to create your own new Virtual Device and delete the corrupted one!

Even though I don't know what exactly caused the avd creation problem in a new laptop. I did exactly the same thing as user #Jamalla posted. I clicked finish and tried to run my sample app in the existing emulator. As Jamalla pointed out the config.ini file was corrupted. So I deleted the existing AVD and created a new one. But I couldn't start it either because my VT was not enabled in my BIOS.
After enabling my VTx in BIOS menu I was able to start the AVD with no issues.

I had a problem running emulator on OSX El Capatain. It turned out .android directory owner was root. I have changed the ownership resolved the problem.

I am running a 64-bit version of Ubuntu, I installed some 32-bit libraries as stated in installation instructions on the Android Studio web page with the following command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
After the above command I reinstalled the Android Studio the problem disappeared.

Related

Im unable to install Intel HAXM file in Android Studio 2021.3.1, in Windows 10 OS

I tried to install through SDK Manager in Android Studio 2021.3.1 but it did not have 'Extras' folder as suggested, so couldn't go further. I also tried to install setup manually in C:\Users\User_Name\AppData\Local\Android\Sdk\extras\intel but it gave the error: "System Requirement Not Fulfilled". I also tried through BIOS by changing the virtual environment but luckily I saved myself from crashing my OS. Please help to solve my problem.

Android Emulator is not running on Android Studio 3.3.2 (MacBook Air)

I have installed Android Studio 3.3.2, I had some problems with the SDK path and I cannot run the app from my application icon, but from the terminal window using sudo ./studio. I had to set the SDK path and re-install SDK into a new folder.
Now I cannot run the AVD emulator and I get the following error messages:
18:23 Emulator: emulator: ERROR: Unknown AVD name
[Pixel_2_XL_API_28], use -list-avds to see valid list.
18:23 Emulator: Process finished with exit code 1
I have been through all the other fixes, such as re-installing Android Studio, re-installing the emulation, Intel x86 Emulator accelerator enabled, deleting all the virtual devices and re-building them.
There is one problem, which is my MacBook keeps reporting "Your disk is almost full" currently have 1.5GB spare space on the drive.
I have been through all the other fixes, such as re-installing Android Studio, re-installing the emulation, Intel x86 Emulator accelerator enabled, deleting all the virtual devices and re-building them.
I have read the path might be set wrong for the AVD drivers, but cannot see anywhere these are present in the Android Studio.
Could the problem be with the lack of space disk space or something else going?
I re-built by MacBook and re-installed Android Studio and all problems resolved.

/dev/kvm not found in Android Studio (Windows 10)

I was using Android studio on windows 8.1 and it was working fine. Now I upgraded to windows 10 with a clean install and installed android studio. When I open AVD manager and creates a new emulator, it says /dev/kvm not found. I tried these after googling but nothing worked for me-
Go to sdk\extras\intel\Hardware_Accelerated_Execution_Manager and install intelhaxm-android.exe
Download a fresh copy of Intel HAXM and install, but it says failed to configure driver: unknown error. failed to open driver.
Re-install HAXM from SDK manager, but it says Windows blocked the installation of a digitally unsigned driver. Uninstall the program or device that uses the driver and check the publisher's website for a digitally signed version of the driver
Downloading workground patch for HAXM, extract to haxm folder and Run as administrator.
My System
OS- Windows 10
Processor- Intel Core i3 third gen
Intel Virtual Technology already enabled from bios.
Hyper-V is also unchecked
I found that, when I start my PC by disabling driver signature enforcement, the emulator is working fine..
At least its solved i justa instled the new HAXM version 6.0.4 at this will work:
Here is the link:
HAXM v6.0.4

Error while waiting for device: Time out after 300seconds waiting for emulator to come online

I have been trying to use android studio 2.0 emulator but I can not run my App on the Emulator. When I Run my App it shows the emulator with following details:
Hax is Enabled
Hax ram_size 0x800000000
HAx is working and emulator
runs in fast virt mode.
console on port 5554,
ADB on port 5555
After that it takes to next TAB Launching app and shows
Waiting for the device to Come online
After that it shows error:
Error while waiting for device: Time out after 300seconds waiting for emulator to come online.
What I have tried so far.
Installed fresh android studio 2.0 with all update to date SDK
Tired to increase Emulator Memory.
Installed android studio 2.1 Beta with latest SDK
Discussed this issue on Google.
What's the solution?
I haven't found any solution yet. I opened new issue on 4th may 2016 because it is known bug in previous versions. Please report on the following link if you have same issue.
https://code.google.com/p/android/issues/detail?id=209095
The solution for me was setting the Graphics option on the Android Virtual Device to Software instead of Automatic or Hardware.
I believe this was the solution because I am working on a windows machine that did not have a dedicated graphics card.
You might have forwarding enabled on adb. You can try this: Quit Android studio and launch terminal. Run these commands:
adb kill-server
adb forward --remove-all
adb start-server
Now you can launch Android Studio and try again.
Also something that can go wrong: Make sure you exit Docker for Mac (possibly all other kind of docker installations as well).
My problem went away after I shutdowned VirtualBox on my machine.
One thing I know is that Linux KVM can't get along with VirtualBox well.
I found a workaround even though I am not sure why this is happening.
Go to Menu->Tools->Android and uncheck the option Enable ADB Integration
Run the application. Now the emulator will be launched, but app will not run. Once the emulator is fully launched, check the Enable ADB Integration option and re-run the app. Now the app will be launched in the already running emulator.
Go to Device Manager (Tools -> Device Manager)
Wipe the data of your device and try starting it again.
Go to Android Studio Command Line, and follow these steps:
__> cd /Users/your_root_name/.android/avd
__> ls
__> rm -r Nexus_5X_Edited_API_17.avd There are two avd files.
Rerun the app.
You could try :
run the emulator from the console manually and see whether adb can connect("see") it from android studio. Does it run at all?
delete avd , recreate a new one for testing, always a good idea in 2.0. lot's of stuff is changing ( instant run etc.)
what does adb say from console ? adb kill-server , adb start-server, start an emulator, then adb devices does it list your emulator ?
try to change this solved my issue, you may other graphics options, and change to a lower resolution model
Upgrade to the latest SDK, for the android emulator:
use 512MB RAM
256MB heap
You can leave the default disk space.
I had the same problem. I'm using Android Studio 2.3 and Debian 9.1 Stretch 64 bits.
In my case, the problem was in default settings established in graphics aceleration configuration.
To solve the problem I opened the AVD Manager, then I selected the device and I opened config file (config.ini) selecting "Show on disk" option whitin "Actions" column. Within the file, I changed the value setted in hw.gpu.mode variable from mesa to swiftshader. After saved the changes, the emulator started without any problems.
More options availables could be found on this link.
These are the steps I took (I'm on Linux).
Switched to Software rendering (works but is too slow)
Tried running on commanline and an error displayed.
Forced emulator to use the system graphic drivers.
First, as #jlars62 suggested, I tried using Switching the Graphics to "Software" and this DID work. However, the performance is far to slow so I dug a little deeper.
Then I tried running the device from the console, as #CaptainCrunch suggestion. (My device was created in Android Studio; emulator in the Sdk may be in a different place on your system)
$ ~/Android/Sdk/emulator/emulator -avd Nexus_6_Edited_768Mb_API_23
For me this produced the following error:
libGL error: unable to load driver: i965_dri.so
libGL error: driver
pointer missing libGL error: failed to load driver: i965
...
Which I tracked down (on ArchLinux) to mean it's using the wrong graphic drivers (Android Sdk comes with it's own). You can force the system ones on the commandline with -use-system-libs:
$ ~/Android/Sdk/emulator/emulator -avd Nexus_6_Edited_768Mb_API_23 -use-system-libs
To force Android Studio to do this you can intercept the call to "emulator" like so (See Mike42) :
$ cd ~/Android/Sdk/tools/
$ mv emulator emulator.0
$ touch emulator
$ chmod +x emulator
In the new emulator file add this:
#!/bin/sh
set -ex
$0.0 $# -use-system-libs
I experienced a similar issue with android studio 2.2. Re-installing a new system image didnt resolve for me. Then found this solution on this link.
unchecking the Enable ADB Integration option and checking it back seem to resolve it for me. I hope this helps someone out there.
Android API Version for application and device should match. Check if minSdkVersion and targetSdkVersion in Gradle Scripts - build.gradle (Module: app) correspond device API.
Also low versions (e.g. API 15) result in ide-emulator link failure, inspite of applicatrion and device versions match.
I had the same problem. I removed virtual device and run app on my phone - worked well.
To remove virtual device: Click icon "AVD Manager" in Android Studio, select virtual device and in context menu click "Delete".
Then turn on on the phone "Developer mode". Connect phone via USB to the laptop.
Restarting ADB server works for me, but no need to go for it from command line.
Ctrl + Maj + A -> Troubleshoot Device Connections -> Next -> Next -> Restart ADB Server
Sadly none of the solutions worked for me! I solved my problem by uninstalling existing APK from my phone and it all started working perfectly!
This started happening after I've updated android studio to latest version.
I almost tested all solutions in this topic and other pages. Finally after lots of searching I found the issue!
I had to enable Hyper-V on my system (If your system does not support Hyper-V you need to install HAXM instead).
In this link you can read about enabling Hyper-V and HAXM: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?pivots=windows
If you install HAXM and still doesn't work go to this link below and install Hyper-V.
Next, restart your computer.
If It doesn't work again remove the emulator and reinstall again with a high API.
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?pivots=windows
I experienced a similar issue, i fixed it by deleting the Android emulator then created a new one with a higher API level.
In my case I've selected API-30
To fix it I went to Tools > SDK Manager > SDK Tools and updated Android SDK Build-Tools 31
Somebody said they needed to do a cold boot afterword
I encountered the same problem, when I tried to run it from the terminal by following command
~/Documents/development/android/SDK/emulator/emulator -avd Resizable_Edited_API_31
I encountered the following error
qemu-system-x86_64: -chardev socket,port=36201,host=::1,nowait,nodelay,ipv6,id=modem: address resolution failed for ::1:36201: Name or service not known
^C^X^Z
And I realized that I had disabled ipv6 in the system, after I activated it, avd ran for me.
Usually, deleting the current emulator that doesn't work anymore and creating it again will solve the issue. I've had it 5 minutes ago and that's how I solved it.
I have faced the same issue you have mentioned and could solve it by just deleting the current avd and creating a new one.It's working perfectly well now.
This error is gone for me by remove the AVD and create a new one.
after some compile and clean, the error was gone away.

Android app is not launched in emulator in Android studio

I created an app in Android studio. It builds and runs on my phone but, When i run emulator it runs and shows the phone.
The output:
emulator: WARNING: Crash service did not start
qemu-system-i386.exe: -drive if=none,index=1,id=cache,file=C:\Users\one\.android\avd\Nexus_5_API_23_new.avd/cache.img: could not open disk image C:\Users\one\.android\avd\Nexus_5_API_23_new.avd/cache.img: Could not open 'C:\Users\one\.android\avd\Nexus_5_API_23_new.avd/cache.img': Invalid argument
How to fix this?
It may be bad, but it´s working for me:
First, go to your SDK folder (i.e. %localappdata%\android\sdk)
Open the "tools" folder.
There you find an "emulator-crash-service.exe" file. Copy it to the same folder and rename it to "emulator64-crash-service.exe".
Go back to the SDK Folder and go to the subfolders "extras\intel\Hardware_Accelerated_Execution_Manager\" and launch the "intelhaxm-android.exe" to install the HAXM driver manually.
Now create a new AVD and it should start.
I solved this problem by:
- redownloading Android x86 image (64bits/api23/google_apis in my case)
- creating a new virtual device and choosing Nexus 5 instead of Nexus 4
I'm not sure if all steps are required.

Resources