Waiting for Target Device to Come Online
Asked Answered
M

46

192

I recently updated to Android Studio 2.3, and now when I try to run the application, the emulator does not come online. It times out after 300 seconds.

Additionally, The app has been experiencing a FATAL EXCEPTION ERROR (OOM), and I am not sure how to fix that either, or if that is part of the emulator problem.

Any help is much appreciated. Again, my knowledge in the program is very limited so if your answer can be kept simple, that would be great.

Matthews answered 15/3, 2017 at 16:56 Comment(2)
this is occuring for me also after the update. adb keeps saying the device is offline. i think its a studio bug. switching to genymotion emulator resolves my issues.Tracay
I'm getting this issue with real devices, no emulator. Android Studio 4.2.2 , Platform-tools up to dateDeathday
D
78

I too had the same problem, then I went to AVD manager and right click on the emulator and stopped it and I RUN the application again and this time it worked. It may be a temporary solution but works for the time being.

Tools -> AVD manager -> right-click on the emulator you are using -> Stop

Now Run your application again.

Note: Sometimes closing the emulator directly is not working for the above-mentioned problem but stopping it from the AVD manager as mentioned is working.

Disingenuous answered 22/3, 2017 at 22:15 Comment(8)
Seems as if there was a problem with the emulator. This worked! Thank you!Matthews
Not sure about Android Studio 2.3.1, but when this problem encountered for the first time in 2.3.0 this solution worked. I never encountered the same problem in 2.3.1Disingenuous
I think this might accidentally work at fixing the race condition, but the real 100% solution is MarkDubya's below.Correspondence
I have same problem and following the steps did not help it resolve yetSinglet
This answer pointed me in the right direction but what helped was using the "Cold boot" option from AVD Manager.Outdistance
Cold boot helped!Apiarian
even cold boot doesn't help more :(Rinaldo
adb kill-server (after you closed the emulators) could helpShopping
S
202

Following worked for me on Android Studio 3.x.

Step 1: Open AVD Manager.

enter image description here

Step 2: Right click and Wipe data for the virtual device you're testing on.

enter image description here

Shanitashank answered 2/10, 2017 at 6:5 Comment(9)
Thanks, it finally worked. Probably some files that weren't updating properly on the emulator.Jinx
Worked for me with AS 2.3.3 and Nexus 5XBerardo
Thanks buddy :) Works like a charm. Had anyone reported this to Google Developers?Nakisha
I ended up creating a new emulator (needed to anyway for screen size) and deleting the old one. That fixed it as well.Endurable
Worked for me in Android Studio 3.5.3Tempi
So far the best solution for me. Just all the stored data are wiped but finally it is workingHuynh
This worked for me right away. I'm using the latest version of Android Studio as of this writing.Hach
Worked very well. Note that AVD Manager is now called Device Manager, and instead of right-clicking the device you have to click the downwards arrow to the right under "Actions" to find the "Wipe Data" option.Nynorsk
didn't work for meAshleighashlen
D
78

I too had the same problem, then I went to AVD manager and right click on the emulator and stopped it and I RUN the application again and this time it worked. It may be a temporary solution but works for the time being.

Tools -> AVD manager -> right-click on the emulator you are using -> Stop

Now Run your application again.

Note: Sometimes closing the emulator directly is not working for the above-mentioned problem but stopping it from the AVD manager as mentioned is working.

Disingenuous answered 22/3, 2017 at 22:15 Comment(8)
Seems as if there was a problem with the emulator. This worked! Thank you!Matthews
Not sure about Android Studio 2.3.1, but when this problem encountered for the first time in 2.3.0 this solution worked. I never encountered the same problem in 2.3.1Disingenuous
I think this might accidentally work at fixing the race condition, but the real 100% solution is MarkDubya's below.Correspondence
I have same problem and following the steps did not help it resolve yetSinglet
This answer pointed me in the right direction but what helped was using the "Cold boot" option from AVD Manager.Outdistance
Cold boot helped!Apiarian
even cold boot doesn't help more :(Rinaldo
adb kill-server (after you closed the emulators) could helpShopping
S
59

In case you are on Mac, ensure that you exit Docker for Mac. This worked for me.

enter image description here

Shilling answered 20/4, 2017 at 9:47 Comment(7)
Genius!! saves lot of time ... kudos!Goodhen
What is a Docker for Mac?Lamellirostral
always docker!~Agreeable
Can someone please explain how to exit Docker for Mac?Attwood
Why is Docker causing a problem with the emulator in this case? This works for me but I want to know why Docker conflicts with the emulator?Storfer
This would be helpful if there was instructions on exiting the "Docker" on a Mac??Aitken
Docker is a virtualization tool, like the Android emulator, but it is more aimed at lightweight systems, I believe controlled only by command line, it is more used by backend and infrastructure professionalsCluny
I
30

Three days on this, and I believe there's a race condition between adb and the emulator. On a request to run an app, with no emulator already running, you see the "Initializing ADB", then the emulator choice, it starts and you get "Waiting for target to come online". An adb kill-server, or a kill -9, or an "End Process" of adb with the task manager will cause adb to die, restart, your APK installs and you're good to go. It does seem funky to me that an "adb kill-server" causes adb to die and then restart here, but that's another mystery, maybe.

Idden answered 3/4, 2017 at 14:51 Comment(8)
Thank you for tracking this down. This absolutely worked for me with Android Studio 2.3.1Correspondence
2.3.1 on windows 10, killing the adb.exe process so it restarts appears to resolve the issue for me too. Thanks!Metalwork
This should be the answer. The selected answer didn't work for me, but this does every time. Thanks!Loth
In the terminal type: cd to change directory to: android > sdk >platform-tools. Then type: 'adb kill-server'. and then: 'adb start-server'Polyp
On AS v 2.3.3, this proposed solution did not work. I ran adb kill-server from terminal. The waiting for target device... message was not stopped and the server did not restart. I still don't have a solution.Aurochs
@MikeS.I had same issue as you but then I restarted Android Studio after doing MarkDubya suggestionMacaque
Still applies to Android Studio 3.1.4. Come on, Google! This is pretty important stuff to get right!Overtire
Happened today with Android Studio 4.1.0 and all my AVDs. The solutions described in the other answers (Wipe Data or Cold Boot) didn't help. At first I didn't found this answer and wanted to go to the adb logcat route. This is only afterwards that I found this answer which proved I was right in the good direction ^^Appetence
F
26
  1. Another case is Android Emulator should be reinstalled. This can happen, when you install a higher version of Android Studio, then update SDK for it, and go back to previous one.

    Tools - Android - SDK Manager - SDK Tools - Android Emulator - uncheck, apply, check, apply

  2. Disable Docker app if you have it (Mac users).

  3. Restart emulator:

    Tools - Android - AVD Manager (or kill adb process in task manager).

Fabaceous answered 25/4, 2017 at 13:4 Comment(6)
The Emulator wasn't even installed in my case.Collaborate
Nice, this one helped me out!Nata
I tried this option as well however the problem is still there.Singlet
In my case the Android SDK Platform was only partially installed.Rostov
docker was the reason in my case! thanks!Kaczmarek
Or just updated. Following step 1 here, I noticed that all the tools I had installed had updates available. Once I installed the updates, my emulators came online.Perrine
C
18

Go to AVD Manager in your Android Studio.Right Click on your emulator,and then select wipe data.Then run your app again. The emulator will perform a clean boot and then install your apk then your app will finally run.

Summary:AVD Manager---Right Click Emulator----Wipe Data----Run App Again

If the problem presists,then simply go back to your avd manager ,uninstall emulator,then add a new emulator.Once the new emulator is added,in your avd manager,run the emulator...Then run your app. Its much simpler if you have an emulator already running from the onset before running your application for the first time

Cranach answered 17/1, 2018 at 7:35 Comment(1)
Only after uninstall/reinstall did it work for me.Electroplate
B
17

After trying all these solutions without success the one that fixed my problem was simply changing the Graphics configuration for the virtual device from Auto to Software (tried hardware first without success)

Binghi answered 17/4, 2017 at 3:4 Comment(2)
Where is this virtual device Graphic Configuration?Portie
@Portie Go to Android Virtual Device Manager (from Tools menu), click Edit (pen icon) on your virtual machine, find the Graphics option there. :)Kadi
C
11

This solution works for me : Tools -> AVD Manager -> click drop down arrow -> select Cold Boot Now

enter image description here

enter image description here

Cammack answered 19/5, 2020 at 12:16 Comment(0)
M
9

Seems like Android Studio (using version 3.5.1) gets into a weird state after a while. This worked for me.

File -> Invalidate Caches / Restart -> Invalidate and Restart

Morissa answered 16/10, 2019 at 21:43 Comment(0)
P
8

Below steps work for me

  1. Close running emulator
  2. Go to AVD Manager
  3. Choose available emulator
  4. In that action tab (last one), click on drop down arrow & select COLD BOOT NOW
  5. Finally run your application
Peltz answered 9/3, 2018 at 6:56 Comment(1)
The cold boot was enough for me.Precocity
A
8

Go to AVD Manager right click on your device and select Wipe Data and Cold Boot Now. For me it worked correctly.

Aprilette answered 20/3, 2021 at 14:51 Comment(1)
Thanks a lot. I'd add one more step: Stop before ColdBoot Now. After that, you can run the application without stopping the device.Dews
F
5

After trying almost all the solutions listed above, what finally worked for me was to create a new virtual device using a "Google APIs" image instead of a "Google Play" image.

Freebooter answered 14/9, 2019 at 14:42 Comment(1)
This must be selected as the correct answer. Thank YouLouislouisa
F
3

Seems that in my case the problem was in that the "Google APIs ARM EABI v7a System Image" wasn't automatically installed during installation of Android Studio.

After installing the image, the emulator began to work.

Screenshot of the SDK manager

Fates answered 24/4, 2017 at 10:17 Comment(1)
Welcome to SO! Please read this how-to-answer.Peterson
D
2

Did not read all the answers. Anyway Accepted one didn't work for me. What did was upgrading the android studio to last stable version and then created a new virtual device. I guess my nexus 5p virtual device got out of sync with the android studio environment.

Derwon answered 22/7, 2018 at 15:45 Comment(0)
D
2

This worked for me on Android studio 4+ and Mac OS

  1. Delete all AVD's that you currently have.
  2. Go to Preferences > Appearance & Behavior > System Settings > Android SDK > SDK Tools
  3. Uninstall Android Emulator
  4. Restart Android Studio.
  5. Re-install Android Emulator from the same place.
  6. Create a new emulator!
Dig answered 25/1, 2022 at 4:19 Comment(0)
H
1

I discovered that having a running instance of Docker on my machine (OSX) prevented the Android Emulator from running (see Android Studio Unable to run AVD)

Previously, my emulator would appear to start, then fail before any device window was shown.

I also had to use 'kill -9' (as per @MarkDubya ) to get Android Studio to connect to the virtual device.

Heiduc answered 10/5, 2017 at 11:30 Comment(0)
M
1

Like urupvog's answer, make sure that you aren't running any other virtual machines like VirtualBox. When I restarted my computer, AVD worked until I started Vagrant for backend development (then it wouldn't launch).

See Android emulator and virtualbox cannot run at same time for more info.

Market answered 19/6, 2017 at 23:49 Comment(0)
F
1

Check you don't have the deviced unauthorized, unauthorized devices reply the same error in the Android Studio, check the emulator once is on with the adb command.

$ adb devices

List of devices attached

emulator-5554 unauthorized

If you have of this way the emulator the Android Studio is waiting for be authorized and maybe this can solve the problem.

Authorized Devices

This is a error I have solved in Windows 10 with Android Studio 2.3.3

Forgiving answered 19/7, 2017 at 9:43 Comment(1)
Please read How do I write a good answer ? Ur just referring another question.Sagunto
P
1

Fix for this issue is simple :

  • Go to SDK tools > SDK Tools
  • Check Android Emulator and click Apply

and sometimes you might see there's an update available next to it, you just need to let it finish the update

Predator answered 15/12, 2018 at 19:29 Comment(0)
S
1

For those stuck on this problem on a device and not the emulator, make sure your app isn't set as the device owner.

Spa answered 4/8, 2021 at 8:20 Comment(2)
How do you change that?Luisaluise
adb shell dpm remove-active-admin package.name/MyDeviceAdminReceiver see here: #49128793Spa
A
1

This happens when you have to instances of Android Studio that both use the same device, which seems to corrupt it irretrievably. Delete the device and create a new one. Thereafter, create new devices and always use different devices in different sessions. Oh, and remember to switch the Logcat window to the new device.

Androw answered 19/6, 2023 at 15:18 Comment(0)
L
0

Question is too old but may be helpful to someone in future. After search many things, most of them is not worked for me. SO, as per my try This solution is worked for me. In short uninstall and install "Android SDK Tools" in Android SDK.

Few steps for that are below:-

  1. go to "SDK Manager" in Android Studio
  2. go to "SDK Tools" tab
  3. Uninstall "Android SDK Tools" (means remove check(uncheck) ahead of "Android SDK Tools" and Apply then OK)
  4. Close and Restart Android Studio
  5. Install "Android SDK Tools" (means check ahead of "Android SDK Tools" and Apply then OK)

Image of Uninstall and Install Android SDK Tools again

Limp answered 3/4, 2017 at 6:1 Comment(2)
this question is neither old nor does your answer solve the problem for me ^^ I uninstalled whole Android Studio, all SDK tools and stuff, reinstalled... doesn't change.Chinkapin
@Chinkapin Then may be you have problem with virtualbox (means virtual machine). Find solution for that. Best of luck!! Thanks anyway..Limp
F
0

The problem is that there is no link between ide and the emulator.

In our case - we lowered version of android for the app, that frustrated ide in emulator linking.

If we install Android 25 and bind project to it, and AVD Device on Android 25 as well - it links and apllies changes on the fly. If we downgrade to Android 14 and device on android 14 - it doesn't.

Used Android Studio 2.3.

To play with versions you can set in Gradle Scripts - build.gradle (Module: app):

android {
  compileSdkVersion 25
  defaultConfig {
    minSdkVersion 15
    targetSdkVersion 15
  }
}

As a result app won't run on an Android 25 device with a message:

Installation failed with message Failed to finalize session : -26: Package ru.asv.test new target SDK 15 doesn't support runtime permissions but the old target SDK 25 does.. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Fabaceous answered 13/4, 2017 at 4:39 Comment(0)
D
0

I also ran into this problem and probably found the solution that may help. The key is launching the AVD in the emulator first then run your App.

Following are the steps:

  1. In the Your Virtual Devices screen, select the device you just created and click Launch this AVD in the emulator
  2. Once the emulator is booted up, click the app module in the Project window and then select Run → Run
  3. In the Select Deployment Target window, select the emulator and click OK.
Disproportionation answered 29/4, 2017 at 0:55 Comment(0)
B
0

For Linux users using KVM and facing this problem try setting the Graphics option on the Android Virtual Device to Software instead of Automatic or Hardware . As previously mentioned in this answer.

I can confirm that the method works for Arch Linux, Ubuntu 16.04, as well as windows with or without a proprietary graphics card using Android Studio version 2.3.1+

Ballarat answered 16/5, 2017 at 1:28 Comment(1)
thx. it works for me. got is working by setting hw.gpu.mode = host in config.ini fileFagen
L
0

I am working on notebook, Windows 8. I solved this issue change mode from battery saving mode to balanced mode. Before that, an emulator didn't work and I see "Target Device to Come Online". Also didn't work Genymotion

Lapin answered 19/5, 2017 at 13:19 Comment(2)
Hi Delphian can mention where can i change the battery saving mode to balanced modeVig
On your notebook in the lower right corner there is a battery icon, you need to click on it and check what your energy saving mode is.Lapin
Q
0

I had a similar problem when updated my android studio. Somehow it changed my SDK path. I just changed it to my updated SDK path and it worked.

Android Studio -> File -> Settings -> Appearance & Behaviour -> System Settings -> Android SDK

Here you will find Android SDK location just click on edit link in front of that and browse and select the Android SDK from the file browser. Select and click on Apply.

Select AVD manager and start Emulator. This solution worked for me.

Quickfreeze answered 30/5, 2017 at 14:11 Comment(0)
F
0

Go to terminal and type android avd. Select your AVD and select "Edit". Make sure you do not see No CPU/ABI system image available for this target - it will show in red font at the bottom. Change the target to the one that is available or download the ABI image. Sometimes, if you create an AVD from inside Android Studio, it does not ensure this requirement.

AVD error

Falcate answered 27/6, 2017 at 21:12 Comment(0)
M
0

None of solutions above worked for me, so I had to wipe content of

C:\Users\your_name\.android\avd

and re-create emulated device

Medication answered 18/7, 2017 at 7:45 Comment(0)
D
0

I've had the same problem (AVD not coming online) in a Linux system. In my case, I have solved it setting this environment variable:

$ export ANDROID_EMULATOR_USE_SYSTEM_LIBS = 1

This case is documented here: https://developer.android.com/studio/command-line/variables.html#studio_jdk

Downall answered 28/9, 2017 at 18:24 Comment(0)
D
0

Finally, I solve this problem by setting the right export path in bash file:

export ANDROID_HOME=/Users/[username]/Library/Android/sdk
Donation answered 9/10, 2017 at 3:38 Comment(0)
P
0

I had this issue twice and tried everything in this thread with no results, I finally fixed it closing "BlueStacks" emulator.

If BlueStacks (and maybe others android emulators) are running when I run the app, by default Android Studio installs the app there, even when I never selected it as a device in AVD Manager, then Android Studio waits for an incorrect device "to come online".

enter image description here

Closing BlueStacks (or any other Android emulator) solved the conflict between devices for me.

I hope this info helps someone!

Portie answered 22/2, 2019 at 12:23 Comment(0)
D
0

Once again, please wait for a while, sometimes you missed that it actually worked but you are feeling really stressed and could not wait(I was).

Not sure why I fixed the same issue that happened on my Macbook, however, choose Nexus 5X API R would work somehow. OR below

  1. Wipe Data: Tools->Open AVD Manager and click ▼ the emu "Wipe Data"

  2. Cold Boots Now: Tools->Open AVD Manager and click ▼ the emu "Cold Boots Now"

  3. Uninstall & Reinstall Android Emulator from SDK: Tools->Open SDK Manager->Android SDK(left-side menu)->SDK tools(middle in the main screen), then click "Android Emulator" and APPLY, then again click "Android Emulator" apply to reinstall, so finish

Disqualify answered 10/8, 2020 at 20:58 Comment(0)
L
0

Probably if you haven't solved it yet ... the class name uses accented letters ...

Leotie answered 9/2, 2021 at 17:43 Comment(0)
P
0

I had the same problem when I first tried to run an Android application on a new MacBook Pro with M1 chip. None of the so far suggested options worked for me.

I followed the instructions in this Medium post by Elye, which (referring to this Stack Overflow answer by @AndrewPK) suggested to download an older version of the Android S system images. The target locations suggested in the blog posts are wrong, but (after finding the correct ones, they're not hard to guess) I noticed the ones in the Stack Overflow answer are correct:

Google Play ARM 64 v8a System Image (revision: 2)

Google APIs ARM 64 v8a System Image (revision: 2)

[T]he directory you want to put the unzipped images in is probably something like ~/Library/Android/sdk/system-images/android-S.

For example, the path for the Google Play image is ~/Library/Android/sdk/system-images/android-S/google_apis_playstore/arm64-v8a

Philipps answered 2/8, 2021 at 21:4 Comment(0)
C
0

in my case (i using Pixel 3 Emulator with playstore installed)

  1. i tried to run the app on real device (if its ok proceed to next step)
  2. i created new device with no playstore installed (ex : Pixel 2 XL) It works in my case
Cunaxa answered 22/11, 2021 at 16:37 Comment(0)
D
0

All the answers say the same thing, but I found out that this error happens sometimes when the targetSdkVersion is not the same version of the emulator. As soon as I increased the version, the problem stopped.

Duisburg answered 14/4, 2022 at 19:47 Comment(0)
B
0

if you have issues on your device (not emulator) you have to remove active admin using this:

adb shell dpm remove-active-admin package.name/MyDeviceAdminReceiver

in order to set device admin again you can use this:

adb shell dpm set-device-owner package.name/MyDeviceAdminReceiver

(do not forget to add C:\Users<current user>\AppData\Local\Android\Sdk\platform-tools path to your environment variables)

Bopp answered 22/8, 2022 at 15:52 Comment(0)
G
0

I went to "AndroidManifest.xml"

and changed

android:exported -> false to true and the error was resolved.

Guglielma answered 5/9, 2022 at 13:25 Comment(0)
T
0

If you're an Asus ROG laptop, remove or close the GameFirst software. I'm finally able to use Android Studio again.

Tumpline answered 21/1, 2023 at 15:23 Comment(0)
F
0

Try deleting your current emulator and creating a new one.

I also encountered the same problem and what’s strange is that even rebooting and clearing the emulator via wipe data didn’t help me. Then I decided to delete the current emulator and create a new one and it worked for me

Flavine answered 28/1 at 14:11 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.Francklin
A
-1

I was having the same problem as you, android studio said I had Emulator 25.3.1 already installed

I deleted the Emulator folder (it's inside the SDK folder)

And then reinstalled Emulator 25.3.1 Sdk manager--> SDKtools --> instal the emulator 25.3.1

This time it worked :)

Ataman answered 20/3, 2017 at 21:1 Comment(0)
A
-1

Go to Run/Debug configuration -> General tab

Select blank device in Prefer Android Virtual Device combo box

Now every time when you run the app, it will run on the device already open. If no Device is running, it will throw error

Allele answered 22/3, 2017 at 8:8 Comment(0)
F
-1

Make sure you have enabled USB debugging on your device


Depending on the version of Android you're using, proceed as follows:

  • On Android 8.0 and higher, go to Settings > System > About phone and tap Build number seven times.
  • On Android 4.2 through 7.1.2, go to Settings > About phone and tap Build number seven times.

Return to the main Settings menu to find Developer options at the bottom. In the Developer options menu, scroll down and enable USB debugging.

Frenum answered 12/9, 2020 at 7:23 Comment(1)
That makes no sense since it won't see the device. Thus that wouldn't resolve the issue. The IDE Android Studio etc. is able to see the device before running the project. The issue shows up whist wanting to install and run the project on tageted device.Literary
P
-3

Tools - Android - Sdk manager - tab Sdk tools - install emulator 25.3.1

Paleozoic answered 15/3, 2017 at 16:59 Comment(1)
Problem is after installing emulatorNutlet
U
-5

Go to the Sdk manager--> SDKtools --> instal the emulator 25.3.1

Undetermined answered 16/3, 2017 at 13:39 Comment(1)
This looks like a repeat of this existing answer.Jaquiss

© 2022 - 2024 — McMap. All rights reserved.