可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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
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.
Anyone know any solution.
Thanks in advance.
Edit
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
回答1:
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.
回答2:
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.
回答3:
Also something that can go wrong: Make sure you exit Docker for Mac (possibly all other kind of docker installations as well).
回答4:
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.
回答5:
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 ?
回答6:
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.
回答7:
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.
回答8:
Upgrade to the latest SDK, for the android emulator:
You can leave the default disk space.
回答9:
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.
回答10:
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
回答11:
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.
回答12:
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.
回答13:
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.
回答14:
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.
回答15:
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.