Xamarin c#-应用程序不是';t起动
我在VS上安装了Xamarin,用c#制作android应用程序。一切都很好(我想是的)。 创建新项目并选择在my avd(5.0 API21)上运行示例应用程序后。AVD启动,但我的应用程序未显示。另外,当我将签名文件复制到我的Android手机(5.0.1 API21)时,它会显示“应用程序已停止” 等待之后,我得到了但部署已检查Xamarin c#-应用程序不是';t起动,c#,android,xamarin,C#,Android,Xamarin,我在VS上安装了Xamarin,用c#制作android应用程序。一切都很好(我想是的)。 创建新项目并选择在my avd(5.0 API21)上运行示例应用程序后。AVD启动,但我的应用程序未显示。另外,当我将签名文件复制到我的Android手机(5.0.1 API21)时,它会显示“应用程序已停止” 等待之后,我得到了但部署已检查 The application could not be started. Ensure that the application has been insta
The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).
Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.
我的代码:
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++); };
}
protectedoverride void OnCreate(捆绑包)
{
base.OnCreate(bundle);
//从“主”布局资源设置视图
SetContentView(Resource.Layout.Main);
//从布局资源中获取我们的按钮,
//并在其上附加一个事件
Button Button=FindViewById(Resource.Id.MyButton);
button.Click+=delegate{button.Text=string.Format(“{0}clicks!”,count++);};
}
确保以下内容在MainActivity类之上
[Activity(Label = "YourAppName", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
确保以下内容在MainActivity类之上
[Activity(Label = "YourAppName", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
您是否已将MainLauncher设置为true?是。。。据了解,车辆速度通常较慢。AVD加载后你等了一段时间了吗?由于这个原因,通常建议使用Xamarin Android Player或其他模拟器,如Genymotion,而不是AVDs。是的,我等待了,我得到“应用程序无法启动。请确保应用程序已安装到目标设备上,并且具有可启动的活动(MainLauncher=true)。此外,请选中Build->Configuration Manager以确保此项目已设置为此配置部署。“但已选中Deploy。将APi更改为4.4解决了此问题!”!您是否已将MainLauncher设置为true?是。。。据了解,车辆速度通常较慢。AVD加载后你等了一段时间了吗?由于这个原因,通常建议使用Xamarin Android Player或其他模拟器,如Genymotion,而不是AVDs。是的,我等待了,我得到“应用程序无法启动。请确保应用程序已安装到目标设备上,并且具有可启动的活动(MainLauncher=true)。此外,请选中Build->Configuration Manager以确保此项目已设置为此配置部署。“但已选中Deploy。将APi更改为4.4解决了此问题!”!