Android Studio - Error in launch emulator - Vulkan-1.dll - android-studio

when I launch the emulator in Android Studio, the following two errors occur in the event log:
Emulator: handleCpuAcceleration: feature check for hvf
Emulator: cannot add library vulkan-1.dll: failed
Someone knows how to solve them?
Thank you,
Marco

I met this situation when I upgrade android emulator to 30.7.5
You need to create
"advancedFeatures.ini"
inside android folder
C:\Users\YourUser.android\advancedFeatures.ini
put this text inside it
# Here's how to disable Vulkan apps to talk to the emulator.
# Add the following lines to ~/.android/advancedFeatures.ini (create this file if it doesn't exist already):
Vulkan = off
GLDirectMem = on

I think you don't have the JDK installed.
Check it out with this command (for example, on the command line):
flutter doctor
If there is an exclamation mark or a red cross next to the "Android toolchain" line, then you do not have the JDK installed.
The solution to this problem is very simple:
Download JDK from this link;
Extract it and rename the internal
folder “jdk8u202-b08” to “openjdk” and copy it under HDD or SSD (so
its path will be: C:\openjdk);
Set Some Environment variables
(search on google if you don't know). Name: "JAVA_HOME", path
"C:\openjdk";
To restart a computer.
This should help. Good luck!

Related

I try to make android studio (emulator) work with vs-code but have an error "avdmanager is missing from the Android SDK"

This is my PATH
export ANDROID_SDK_ROOT=/mnt/sda1/DevTools/sdk/
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=${PATH}:/mnt/sda1/DevTools/sdk/platform-tools
I try many cases, but still this error!
Try :
flutter doctor --android-licenses
if something wrong, try to locate android sdk path.
flutter config --android-sdk {path}
Mine :
flutter config --android-sdk C:\Android\Sdk
This worked for me. If you have sdkmanager, avdmanager and emulator, and you have them in your PATH environmental variable, then
Download a system image:
sdkmanager "system-images;android-30;google_apis_playstore;x86_64"
(you can find available packages with sdkmanager --list --verbose)
Create a new virtual device with
avdmanager create avd --name MyAndroidDevice --package "system-images;android-30;google_apis_playstore;x86_64"
Start the emulator
emulator -avd MyAndroidDevice
Now restart VSCode and open your Flutter project. The new device should be at the bottom right corner or you should be able to choose it by clicking on "No device".
For me, I had to restart my VS Code for the installation of Android SDK be reflected upon it.
I know this is an old question but setting my $PATH variable in ~/.bashrc (I'm on Ubuntu 20.04) did not work for me.
I needed to setup Android Emulator for VScode, because I wanted to run my flutter app, which seems to be the same issue as OP had.
Instead of setting the $PATH directly you can actually use Flutter in the terminal to do it.
If you run "flutter config" in the terminal you get something like:
Configure Flutter settings.
To remove a setting, configure it to an empty string.
The Flutter tool anonymously reports feature usage statistics and basic crash reports to help
improve Flutter tools over time. See Google's privacy policy:
https://www.google.com/intl/en/policies/privacy/
....
Run "flutter help" to see global options.
Settings:
android-sdk: <my_path_to_android_tools>
Analytics reporting is currently enabled.
You can then see the $PATH that is currently set with flutter under:
Settings:
android-sdk: <my_path_to_android_tools>
Mine was incorrect so I changed it to the current one with the command:
flutter config --android-sdk <my_path_to_android_tools>
Afterwards I restarted VScode and when it was finished loading I could now press the "device" button in the right hand corner and then select emulator that I had already created. I used one of the above answers to install the emulator itself.
It took a while to launch the emulator the first time due to installing some dependencies but it did work!
I tried this and works:
from terminal run flutter config --enable-android. You will get Setting "enable-android" value to "true".
after that open android studio, set up virtual devices first if you haven't. Open Android Studio -> Configure -> AVD Manager -> Create Your Virtual Device
Go back to your VS Code, open command Palette (Ctrl+P or cmd+P, then type >), or from View -> Command palette... -> Flutter: Select Device -> choose your android device
I faced the same issue and solved it running flutter doctor from the terminal, in VS Code. In my case, I had the android sdk located in a custom location (D drive), the reason why it wasn't found automatically. The "doctor" told me to run flutter config --android-sdk <my-sdk-custom-location>. Running it and restarting the IDE made the trick. Hopefully this helps someone facing the same problem.

Not able to connect adb after upgrate Android Studio to 3.4

unable to connect to adb.check the event log for a possible issue, verify that localhost entry is pointing to 127.0.0.1 or:: 1 for ipv4 or ipv6
Tried adb kill-server, restart, invalidate restart nothing works.
Same issue reported over here https://issuetracker.google.com/issues/130791561
Note: I have not added any file or anything in studio, it's fresh installed Studio after format a full system still issue is there.
Replace your platform-tools with this one and delete the other one.
https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip
I was also facing this issue in android Studio 3.4 version, but now I have fixed it , if you are using windows then follow these steps:
Download Platform tools from here
https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip
Extract downloaded zip file
Go To location "C:\Users\your_computer_user_name\AppData\Local\Android\Sdk" and Delete "Platform tools" folder
Copy and Paste, downloaded platform tool folder to above location
Now Go to your android studio and Rebuild your project Then run.
For Mac Users, follow these simple steps :
Just simply Navigate to Tools > SDK Manager> Android SDK>, then click on the Tab of SDK Tools, then look for Android SDK Platform-tools and update it.
Then the last step, Invalidate cache and restart your IDE, after that, then finally you restart your Mac. (Sometimes it's this step is unnecessary)
It will work out successfully.
Solution for Linux Users.
System info: Linux Mint Cinnamon 19.1 , Android Studio 3.4.1
Issue description: Problem with platform tools.
Solution: Remove the folder manually and update SDK tools through Android Studio.
Step 1: Go to your Android SDK installation folder. By default under your home directory. Choose platform-tools and simply delete. (/home//Android/SDK)
Step 2: Open Android Studio and go to SDK Tools. (File -> Settings -> Appearance & Behaviour -> System Settings -> Android SDK -> SDK Tools) By the moment you should be able to see Android SDK Platform Tools line unchecked.
Step 3: Put a check to install Platform Tools and press OK. Notice it'll relocate the folder to the directory where deleted.
Now that you re-installed the platform tools, restart the Android Studio and your deployment targets should show up.
If you don't install the platform tool back and ever try to build or run a project you'll get this IDE error. Just FYI :)
So that's all. Enjoy.
Happy coding
If you use Windows, you might have a corruption in api-ms-win-crt-runtime-l1-1-0.dll.
Try to update it - you can get the update from Microsoft's website.
You should check it - path/to/sdk/platform-tools and try to run adb.exe
When you update Sdk platform tools(which contains adb.exe) to release 28.0.2 and if you are using windows 8.1 then it needs few updates from windows.
As per SDK Platform tools release notes(https://developer.android.com/studio/releases/platform-tools):
Updated Windows requirements : The platform tools now depend on the Windows Universal C Runtime, which is usually installed by default via Windows Update. If you see errors mentioning missing DLLs, you may need to manually fetch and install the runtime package."
Windows update url: https://support.microsoft.com/en-ca/help/2999226/update-for-universal-c-runtime-in-windows
Prerequisite for Windows update url: https://www.microsoft.com/en-us/download/details.aspx?id=42327
Faced the exact same issue but after updating with prerequisite url first then the other url provided now it is working perfectly fine for me.
It worked for me by selecting -> Use libusb backend
This worked for me on Windows:
Goto cmd write %temp% hit enter -> delete all data from there.
Restart your Computer.
Open Android Studio now, it will work.
Clear all cache memory (related to Android Studio)
Restart ADB manually from Android Studio (first option)
Open Command prompt and got android sdk>platform-tools> adb kill-server
press enter
and again adb start-server
press enter
Restart ADB manually form Android Stidio (second option)
go to your (SDK store path) sdk>platform-tools>adb
press enter
ex. D drive > sdk>platform-tools>adb
Restart your system
Delete the platform-tools folder from the sdk and replacing with the same from your another pc. I am also facing this problem after updating to 3.4. If you face same problem please update to Android Studio 3.5 Canary Channel.
The reason is for ADB server problem. Simply re-run your adb.
(Go to your SDK folder then inside platform-tools folder you can see adb.exe. copy the path location and paste it in your computers system Environment variable. Set a new path there and paste the adb.exe file location there. hope it will solve )
If you are using Genymotion, there is an update that fix the problem.
Genymotion 3.0.2 (April 18th, 2019)
Corrections
We have fixed an
incompatibility with the adb tool bundled in the platform-tools 28.0.2
package of the Android SDK, which caused failures to start virtual
devices.
This new version of adb changed the behavior of the “adb connect
:” command by making the “port” part mandatory. This
broke Genymotion Desktop in a few places where it did not pass the
port. We have adjusted the way we call “adb connect” and also updated
the version we ship with the product to match the one in
platform-tools 28.0.2.
If non of the above answers worked for you (as same happend to me), down grade to the old version of Android Studio by following these steps:
Uninstall current Android Studio
Go to Android Studio Archive and download any older version
After installation, Open the project. You might see an error like this
This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer.
Now, open project gradle and update classpath tools.build version. I.e. in my case Android studio version is 3.2 and classpath 3.2.1
Hope it might save someone time.
I faced this issue last night, and I tried these methods to fix:
download older platform-tools and place it in the android sdk folder.(not work for me)
adb kill-server, adb start-server.(not work for me, adb had no response with these cmd)
kill the process that occupies port 5037.(for me, there is no other .exe run at this port)
reinstall platform-tools in Android Studio.(not work)
download ADB Kits and replace them in platform-tools folder.(work!!!)
It seems that my adb file has been modified or replaced by some programs. You can try these methods, and I hope some of them can work for you.
I had this issue only after a Genymotion update, on Mac.
What worked for me: Open Genymotion preferences, Select ADB, choose "Use custom Android SDK tools" and points to your Android SDK folder.
Actually the problem is not with the android studio version 3.4
Problem is with the android platform tools version which is latest one 29.
So install the previous version of the android platform tools version it will solve your problem. as above #Ved mentioned.
Ved link:
https://dl.google.com/android/repository/platform-tools_r26.0.0-windows.zip
EndTask adb.exe from Background processes (TaskManager) and Run Application again.
It works for me

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.

Genymotion Invalid path: VBoxManage and Initialize Engine: failed

I use:
Windows 7
Android Studio 1.3.2
Genymotion 2.5.4
VirtualBox 5.0.4r
Yesterday, it run correctly. However my C disk is run out of space so i decided to uninstall Andriod Studio, Genymotion and VB. Now I installed it in disk E and i show problem
Genymotion: Genymotion directory: E:\Program
Files\Genymobile\Genymotion
Genymotion: Trying to initialize engine
Genymotion: Invalid path: VBoxManage
Genymotion: Initialize Engine: failed
I already tried some solutions from same topic but not work so far, seem like my case is different. Any one have same issue? Any suggestion? Thanks
Using Windows 10 here, same issue, added the VirtualBox binary directory to the system path and it still failed, so it's not obvious what exactly it's looking for. But I do have Android Studio in a non-standard location too -- I think it's likely that there's a hardcoded relative path in there that's cracking on use. May not be a fix except to reinstall Android Studio where it wants to go...
However, per another answer, if you can start the image in Genymotion the Debug button will be able to see it and connect to it and you can maybe live without the integrated Genymotion device manager until they fix this.
Maybe the file "reg.exe"(in X:\Genymotion) lose, you must get it from genymotion-2.5.3-vbox.exe
I am having the same issue, and while searching I come across this post here that says the plugin (at least for eclipse) doesn't work with Virtual Box version newer than 4.2. I am not sure if this will help but it is worth looking in to.
EDIT:: There was an update to Android Studio to 1.4 and an update to the Genymotion plugin to 1.0.6. It fixes this issue. I updated yesterday and it works like a charm.

Resources