Visual Studio Android Emulator 无法运行应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24960717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio Android Emulator won't run application
提问by MingMan
I recently got into Xamarin development. I have a lot of experience in Xcode making iOS apps and the iOS side was very straight forward. Now I'm trying to implement Android. I downloaded a Hello World example to get my bearings. When I run it I have no problems getting the simulator to show up (MonoForAndroid_API_10
and MonoForAndroid_API_12
) but the actual application doesn't run, and does not show up anywhere on the simulator. Essentially whenever I use run or run with in Xamarin on Android, it pulls up a fully functioning, albeit empty simulator.
我最近进入了 Xamarin 开发。我在 Xcode 制作 iOS 应用程序方面有很多经验,iOS 方面非常简单。现在我正在尝试实现Android。我下载了一个 Hello World 示例来了解我的方向。当我运行它时,我没有问题让模拟器显示(MonoForAndroid_API_10
和MonoForAndroid_API_12
),但实际应用程序没有运行,也没有显示在模拟器上的任何地方。基本上,每当我在 Android 上的 Xamarin 中使用 run 或 run with 时,它都会拉出一个功能齐全的模拟器,尽管它是空的。
How do I get my application to run on the emulator?
如何让我的应用程序在模拟器上运行?
采纳答案by Phil Ryan
Like the other commenters, this is most likely just a symptom of slow emulator on your machine. I'm running Xamarin-Android development on my 2010-era OSX machine in mavericks with 8GB RAM, and it is slow-slow-slow, but usable. Try to find the Intel x86 speeds improvements (look for HAXM
) and you will find that the emulator will be much much faster.
像其他评论者一样,这很可能只是您机器上模拟器速度慢的症状。我正在我的 2010 时代的 OSX 机器上运行 Xamarin-Android 开发,使用 8GB RAM 的小牛,它是慢-慢-慢,但可用。尝试查找 Intel x86 速度改进(查找HAXM
),您会发现模拟器会快得多。
And yeah, get a real handset and plug it in to your computer: always much faster than emulation.
是的,获得一个真正的手机并将其插入您的计算机:总是比模拟快得多。
later editGet Genymotionfor Mac OSX or for PC/Windows or PC/Linux. It's way way way faster than the other emulators. I have since found that this is as fast, or faster, than running the App on my connected Android phone. It's certainly simpler in not having to have the device plugged into one of my USB ports, and allows me to code and test on the train. http://www.genymotion.com/
稍后编辑Get Genymotionfor Mac OSX 或 PC/Windows 或 PC/Linux。它比其他模拟器快得多。从那以后,我发现这与在我连接的 Android 手机上运行该应用程序一样快,甚至更快。不必将设备插入我的 USB 端口之一当然更简单,并且允许我在火车上进行编码和测试。http://www.genymotion.com/
回答by Mateusz Moska
Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB. I was missing key Android SDK Toolswith string value Pathin registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
不知道我的问题是否相同,但最终这个故障排除帮助我运行模拟器https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB。我在注册表 Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node 中缺少带有字符串值路径的密钥Android SDK 工具
I've created it manually and it worked.
我手动创建了它并且它起作用了。
UPDATE
更新
Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well.
在遇到运行模拟器的问题之前,我在 Visual Studio 中看不到它。原因是我通过独立安装而不是通过 VS Installer 安装了 VS Android Emulator。它也必须安装在那里。
回答by casillas
I had the similar issue, and then I deleted the existing device simulator and reinstalled again and it started working.
我遇到了类似的问题,然后我删除了现有的设备模拟器并再次重新安装,它开始工作。
回答by vitor_gaudencio_oliveira
As I use a different SDK, in my case
当我使用不同的 SDK 时,就我而言
Go to Tools > Options > Xamarin and set the Android SDK path.
转到“工具”>“选项”>“Xamarin”并设置 Android SDK 路径。
Sometime Visual Studio changes this configuration;
有时 Visual Studio 会更改此配置;
回答by Talha Rafique
Worked for ME
Sometimes you close the android Emulator but not POWEROFF
the Emulator.
this problem happens when emulator shutdown un-properly.
有时您关闭了 android Emulator 而不是POWEROFF
Emulator。当模拟器关闭不正确时会发生此问题。
Restart Your EMULATOR
重启你的模拟器
- First start your emulator
- Then restart your emulator by
pressing down the power button and select restart
option in your android emulator.
- 首先启动你的模拟器
- 然后通过
pressing down the power button and select restart
android 模拟器中的选项重新启动模拟器。
回答by Mohammad AlShaabi
I enabled Hyper-V acceleration based on microsoft documentations: https://docs.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin&pivots=windows#accelerating-with-hyper-v
我根据微软文档启用了 Hyper-V 加速:https: //docs.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs =vswin &pivots =windows#accelerating -with-hyper-v
Basically you need to turn on these two windows features from the control panel (Turn windows features on of off):
基本上你需要从控制面板打开这两个窗口功能(打开或关闭窗口功能):
- Hyper-V.
- Windows hypervisor platform.
- 超V。
- Windows 管理程序平台。
then from visual studio go to: Tools >> Android >> Android SDK manager >> Tools >> make sure that "Android emulator" version is 27.0.1 or higher, if not, you will find in the same screen a button below to update it.
然后从visual studio转到:工具>> Android >> Android SDK管理器>>工具>>确保“Android模拟器”版本为27.0.1或更高版本,如果不是,您会在同一屏幕中找到下面的按钮更新它。
I did this on windows 10 64-bit, with VS 2017 Community 15.9.5
我在 Windows 10 64 位上使用 VS 2017 Community 15.9.5 执行此操作