在我的 visual studio 到 运行 我的 android 应用程序中找不到模拟器设备
No emulator device found in my visual studio to run my android app
今天我下载 visual studio 2015
。因为我想开始 android 编程。
所以我下载 xamarin for visual studio
正如你在这里看到的 :
所以其他数据包已安装,如您在此处所见:
所以我创建了一个 blank apps
,代码是这样的:
namespace App1
{
[Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}
我安装了这个文件,但我不知道它到底是什么,我认为它是模拟器 mono-4.2.2.30-gtksharp-2.12.30-win32-0
。
但是当我运行这个程序
我收到这个错误:
Severity Code Description Project File Line Suppression State
Warning @(Content) build action is not supported App1 C:\Users\ehsan\Documents\Visual Studio 2015\Projects\App1\App1\Properties\AndroidManifest.xml
我应该补充的是视觉列表中没有模拟器:
SDK 管理员:
您需要做两件事才能让模拟器正常工作 -
- 在 SDK 管理器中为您的目标 Android 版本安装必要的组件。连同系统映像。
- 对于该系统映像,您可以选择 AVD 管理器中存在的预设虚拟设备。
然后启动模拟器并确保您看到主屏幕已加载到虚拟设备中,然后从 Visual Studio 启动应用程序。然后它将 apk 安装到虚拟设备中并启动您的应用程序。
查看SDK管理器安装组件示例图片
检查是否安装了Visual Studio Emulator for Android。
如果没有安装,click here下载。
为 Android 安装和配置 Visual Studio 模拟器的步骤:https://msdn.microsoft.com/en-us/library/mt228279.aspx
Warning @(Content) build action is not supported
这个警告有一个小的解决方法。
- Select
Properties
共 AndroidManifest.xml
- 设置
Build Action
为None
另一种选择是使用 Xamarin Android 播放器:https://xamarin.com/android-player。我发现它工作得很好而且速度非常快。我知道问题是关于 VS 的模拟器,但如果你不能让它工作,这是一个很好的选择。
今天我下载 visual studio 2015
。因为我想开始 android 编程。
所以我下载 xamarin for visual studio
正如你在这里看到的 :
所以其他数据包已安装,如您在此处所见:
所以我创建了一个 blank apps
,代码是这样的:
namespace App1
{
[Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
}
我安装了这个文件,但我不知道它到底是什么,我认为它是模拟器 mono-4.2.2.30-gtksharp-2.12.30-win32-0
。
但是当我运行这个程序
我收到这个错误:
Severity Code Description Project File Line Suppression State
Warning @(Content) build action is not supported App1 C:\Users\ehsan\Documents\Visual Studio 2015\Projects\App1\App1\Properties\AndroidManifest.xml
我应该补充的是视觉列表中没有模拟器:
SDK 管理员:
您需要做两件事才能让模拟器正常工作 -
- 在 SDK 管理器中为您的目标 Android 版本安装必要的组件。连同系统映像。
- 对于该系统映像,您可以选择 AVD 管理器中存在的预设虚拟设备。
然后启动模拟器并确保您看到主屏幕已加载到虚拟设备中,然后从 Visual Studio 启动应用程序。然后它将 apk 安装到虚拟设备中并启动您的应用程序。
查看SDK管理器安装组件示例图片
检查是否安装了Visual Studio Emulator for Android。
如果没有安装,click here下载。
为 Android 安装和配置 Visual Studio 模拟器的步骤:https://msdn.microsoft.com/en-us/library/mt228279.aspx
Warning @(Content) build action is not supported
这个警告有一个小的解决方法。
- Select
Properties
共AndroidManifest.xml
- 设置
Build Action
为None
另一种选择是使用 Xamarin Android 播放器:https://xamarin.com/android-player。我发现它工作得很好而且速度非常快。我知道问题是关于 VS 的模拟器,但如果你不能让它工作,这是一个很好的选择。