Reputation: 1973
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
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
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
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
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
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
Reputation: 2370
This worked for me on Android studio 4+ and Mac OS
Upvotes: 2
Reputation: 427
in my case (i using Pixel 3 Emulator with playstore installed)
Upvotes: 0
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
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
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
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
Reputation: 61
Probably if you haven't solved it yet ... the class name uses accented letters ...
Upvotes: 0
Reputation: 601
In case you are on Mac, ensure that you exit Docker for Mac. This worked for me.
Upvotes: 60
Reputation: 112
Make sure you have enabled USB debugging on your device
Depending on the version of Android you're using, proceed as follows:
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
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
Wipe Data: Tools->Open AVD Manager and click ▼ the emu "Wipe Data"
Cold Boots Now: Tools->Open AVD Manager and click ▼ the emu "Cold Boots Now"
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
Reputation: 1017
This solution works for me :
Tools -> AVD Manager -> click drop down arrow -> select Cold Boot Now
Upvotes: 11
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
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
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".
Closing BlueStacks (or any other Android emulator) solved the conflict between devices for me.
I hope this info helps someone!
Upvotes: 0
Reputation: 791
Fix for this issue is simple :
and sometimes you might see there's an update available next to it, you just need to let it finish the update
Upvotes: 1
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
Reputation: 7641
Below steps work for me
Upvotes: 8
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
Reputation: 6462
Following worked for me on Android Studio 3.x.
Step 1: Open AVD Manager.
Step 2: Right click and Wipe data for the virtual device you're testing on.
Upvotes: 205
Reputation: 19880
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
Disable Docker app if you have it (Mac users).
Restart emulator:
Tools - Android - AVD Manager (or kill adb process in task manager).
Upvotes: 26
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
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
Reputation: 383
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.
This is a error I have solved in Windows 10 with Android Studio 2.3.3
Upvotes: 1
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