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

27

89

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

Zenger answered 17/4, 2016 at 11:1 Comment(7)
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.Motionless
Try the solution provided here: https://mcmap.net/q/41405/-quot-waiting-for-target-device-to-come-online-quot-in-android-studio-2-3Maki
I had to go Android SDK manager and update the emulator software. That fixed it for me.Padre
This may sound ridiculous but after hours of trying many SO solutions what worked for me was to completely remove Android Studio and reinstall without importing any settings. See https://mcmap.net/q/35932/-how-to-completely-uninstall-android-studio-on-macGelderland
I have installed Android Studio on Virtuell Computer which seems to satisfy System Requirements for Android studio and Emulator. Still I am getting this Timeout Error. I tried all of the solutions given here but no luck so far ! any idea what I should try next ? ThanksFairing
For Info :- I am using Android Studio Electric Eel build on Jan 21,2023. have two processor with 2 Cores - Intel(R) Xeon CPU E5 - 2697 v2 @ 2.70GHz, Available Physical Memory - 10,9 GB and Virtualization and Hyper-V enabled on virtual MachineFairing
wiping android emulator data works for me.Korten
T
82

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.

Taxidermy answered 2/1, 2017 at 16:25 Comment(4)
This is not possible for me. I have found the Graphics-Option, but I can't edit it :(Nowt
@Nowt Clone your device before adding it. Then you'll be able to edit it.Kunzite
@andre it works for me to edit it on older images, like 5.1.1 but not on 7.0 for example.Portie
Still no luck here. MacOS :(Uninterrupted
S
27

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.

Skink answered 26/7, 2016 at 21:32 Comment(1)
Got: adb server is out of date. killing... cannot bind 'tcp:5037' ADB server didn't ACK * failed to start daemon *Drub
M
13

Go to Device Manager (Tools -> Device Manager)

Wipe the data of your device and try starting it again.

enter image description here

Montoya answered 14/4, 2022 at 3:51 Comment(2)
This was a quick fix for me. Thanks!Ethiop
Worked for me, was been debugging since hour...thax mate!Priggery
H
10

Also something that can go wrong: Make sure you exit Docker for Mac (possibly all other kind of docker installations as well).

Hypogynous answered 23/3, 2017 at 10:2 Comment(4)
Brilliant, thanks Mario - the moment I read this I knew it was the answer. Just saved me another hour of uninstalling / reinstalling everything ;)Extent
My god, you just saved me. Thanks! :)Feininger
Wow. I would have never thought that Docker is causing this. That worked for me. Thanks. Any ideas why running docker is a problem?Cheeky
How can I do that?Nicotine
T
10

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.

Thermoelectrometer answered 18/4, 2017 at 20:9 Comment(2)
This was causing the issue in my case as well.Islander
Hey, in my case, it's also virtualbox caused the issue. After stopping virtualbox, everything goes well, thank you!Charlinecharlock
P
8

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.

Prophets answered 23/4, 2016 at 11:24 Comment(1)
It throws error "10:23:39 Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled."Marienthal
B
4

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 ?
Breaux answered 6/5, 2016 at 10:17 Comment(3)
Also, you may leave the ADVANCED SETTINGS default (while creating AVD).Mclendon
What if adb doesn't exist in the console/terminal?Snub
@StephanBijzitter This means your environment ist not setup fully. ADB is shipped with the Android SDK. If you're on a Linux system, you have to add the SDK folder to your $PATH variable. This article developer.android.com/studio/command-line/adb.html describes the full path to ADB being "android-sdks/platform-tools/adb" If you just use Android Studio this is done inside its GUIBreaux
O
4

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.

Olag answered 6/5, 2016 at 15:42 Comment(1)
Just see one but also a .ini one?Uninterrupted
F
2

try to change this solved my issue, you may other graphics options, and change to a lower resolution model enter image description here

Form answered 24/9, 2020 at 14:28 Comment(1)
this option is grayed for me, I can't change itCrowded
S
1

Upgrade to the latest SDK, for the android emulator:

  • use 512MB RAM
  • 256MB heap

You can leave the default disk space.

Sequestered answered 22/6, 2016 at 12:41 Comment(0)
I
1

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.

Impletion answered 27/8, 2017 at 17:17 Comment(0)
B
1

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
Bozarth answered 13/10, 2017 at 10:22 Comment(0)
F
0

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.

Flavone answered 27/11, 2016 at 23:41 Comment(1)
this answer was already posted earlier. please, if you have different solutions, offer that.Mclendon
M
0

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.

Motionless answered 13/4, 2017 at 5:12 Comment(0)
M
0

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.

Melcher answered 29/9, 2019 at 19:57 Comment(0)
A
0

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

enter image description here

Alceste answered 22/4, 2020 at 8:12 Comment(0)
T
0

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.

Telescopic answered 6/5, 2020 at 14:54 Comment(0)
S
0

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

Slavey answered 6/7, 2020 at 18:53 Comment(0)
L
0

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
Lightless answered 1/8, 2021 at 21:18 Comment(0)
T
0

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

Tabethatabib answered 19/8, 2021 at 7:41 Comment(0)
U
0

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

Unhallow answered 19/9, 2021 at 15:37 Comment(0)
M
0

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.

Mend answered 31/1, 2023 at 23:28 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Violation
E
0

I have faced the same issue and after having tried basically all the solutions found out there, this was what worked for me:

Go to Preferences -> search for Emulator -> Uncheck Launch in a tool window

Ebullient answered 1/9, 2023 at 12:27 Comment(0)
L
0

In my case I had to do the following

lsof -i :5037
kill <PID>

then you just need to restart the adb

/Users/.../Library/Android/sdk/platform-tools/adb start-server

That should resolve the issue encountered when trying to install the apk

Lizliza answered 12/10, 2023 at 18:43 Comment(0)
I
-1

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.

Inexhaustible answered 17/11, 2016 at 11:8 Comment(1)
this answer was already posted. please, if you have different solutions, offer that.Mclendon
C
-1

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.

Circumstantiality answered 5/1, 2017 at 12:3 Comment(0)
A
-3

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.

Amphipod answered 7/9, 2016 at 6:1 Comment(1)
this answer was already posted. please, if you have different solutions, offer that.Mclendon

© 2022 - 2024 — McMap. All rights reserved.