MMurph23
MMurph23

Reputation: 1973

Waiting for Target Device to Come Online

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.

Upvotes: 196

Views: 341125

Answers (30)

Murad Akhmedov
Murad Akhmedov

Reputation: 61

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

Upvotes: 1

smirkingman
smirkingman

Reputation: 6368

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.

Upvotes: 1

Igal s
Igal s

Reputation: 3049

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

Upvotes: 0

잠 좀자자
잠 좀자자

Reputation: 51

I went to "AndroidManifest.xml"

and changed

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

Upvotes: 0

Dmila Ram
Dmila Ram

Reputation: 1074

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)

Upvotes: 0

Alberto M
Alberto M

Reputation: 1760

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.

Upvotes: 0

user2881604
user2881604

Reputation: 2370

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!

Upvotes: 2

amerw
amerw

Reputation: 427

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

Upvotes: 0

gurnisht
gurnisht

Reputation: 111

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

Upvotes: 1

Glorfindel
Glorfindel

Reputation: 22651

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

Upvotes: 0

WhiteShadow
WhiteShadow

Reputation: 816

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.

Upvotes: 80

Timur
Timur

Reputation: 760

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

Upvotes: 8

Massimo Loporchio
Massimo Loporchio

Reputation: 61

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

Upvotes: 0

urupvog
urupvog

Reputation: 601

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

enter image description here

Upvotes: 60

Aydzan Ahmedov
Aydzan Ahmedov

Reputation: 112

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.

Upvotes: -1

K Lee
K Lee

Reputation: 493

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

Upvotes: 0

mostafa3dmax
mostafa3dmax

Reputation: 1017

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

enter image description here

enter image description here

Upvotes: 11

nkukday
nkukday

Reputation: 745

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

Upvotes: 9

HPage
HPage

Reputation: 1503

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.

Upvotes: 5

stramin
stramin

Reputation: 2390

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!

Upvotes: 0

Hossam Hassan
Hossam Hassan

Reputation: 791

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

Upvotes: 1

sivi
sivi

Reputation: 11114

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.

Upvotes: 2

VVB
VVB

Reputation: 7641

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

Upvotes: 8

RileyManda
RileyManda

Reputation: 2641

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

Upvotes: 18

Vakas
Vakas

Reputation: 6462

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

Upvotes: 205

Zon
Zon

Reputation: 19880

  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).

Upvotes: 26

Indiana
Indiana

Reputation: 323

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

export ANDROID_HOME=/Users/[username]/Library/Android/sdk

Upvotes: 0

jantoniomartin
jantoniomartin

Reputation: 215

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

Upvotes: 0

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

Upvotes: 1

Drahoš Maďar
Drahoš Maďar

Reputation: 567

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

Upvotes: 0

Related Questions