Monodroid 引发错误 [英] Monodroid raises error

查看:40
本文介绍了Monodroid 引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行在 Visual Studio 中创建新项目时默认生成的简单代码.模拟器引发异常.它是 Mono for Android 的评估版本.为什么会发生这个错误?谢谢.

I am trying run simple code which is generated by default when you create new project in Visual Studio. Emulator raises exception. It is evalution version of Mono for Android. Why that error happens? Thanks.

这里是代码

using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace MonoAndroidApplication1
{
[Activity(Label = "MonoAndroidApplication1", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : 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++); };
    }
}
}

此处错误

尝试启动活动MonoAndroidApplication1.MonoAndroidApplication1/monoandroidapplication1.Activity1",但设备找不到它.

Tried to launch activity 'MonoAndroidApplication1.MonoAndroidApplication1/monoandroidapplication1.Activity1', but the device could not find it.

造成这种情况的一个常见原因是手动向您的 AndroidManifest.xml 添加名称与您的 Activity 类不匹配的名称.

A common cause of this is manually adding an to your AndroidManifest.xml whose name does not match your Activity class.

考虑改用 [Activity] 属性:http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml

Consider using the [Activity] attribute instead: http://monodroid.net/Tutorials/Working_with_AndroidManifest.xml

推荐答案

应用程序是否已成功安装到您的设备上?您可以检查应用托盘中是否有它的图标,或检查设置 -> 应用程序屏幕.

Did the application get successfully installed on your device? You can check if there is an icon for it in the app tray, or check the Settings -> Applications screen.

我的猜测是应用程序由于某种原因没有成功安装,并且 IDE 没有正确检测到故障.

My guess is that the app isn't successfully installing for some reason, and the IDE isn't properly detecting the failure.

这篇关于Monodroid 引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆