'缺少类型或命名空间名称'

Bha*_*eya 4 android xamarin

我按照正确的步骤在 xamarin studio 中开发了一个应用程序,如图(https://developer.xamarin.com/guides/android/getting_started/hello,android/hello,android_quickstart/)但是,在构建解决方案后有 11 个错误如 1.'找不到类型或命名空间名称Android。(是否缺少 using 指令或程序集引用?)' 2.'找不到类型或命名空间名称Activity。(是否缺少 using 指令或程序集引用?)' 3.'找不到类型或命名空间名称Bundle。(您是否缺少 using 指令或程序集引用?)' 如何摆脱这些错误?请帮忙

这是代码——

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

        namespace PhoneWord
        {
         [Activity (Label = "PhoneWord", 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 UI controls from the loaded layout:
        EditText phoneNumberText = FindViewById<EditText>(Resource.Id.PhoneNumberText);
        Button translateButton = FindViewById<Button>(Resource.Id.TranslateButton);
        Button callButton = FindViewById<Button>(Resource.Id.CallButton);
        // Disable the "Call" button
        callButton.Enabled = false;

        // Add code to translate number
        string translatedNumber = string.Empty;

        translateButton.Click += (object sender, EventArgs e) =>
        {
            // Translate user's alphanumeric phone number to numeric
            translatedNumber = Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
            if (String.IsNullOrWhiteSpace(translatedNumber))
            {
                callButton.Text = "Call";
                callButton.Enabled = false;
            }
            else
            {
                callButton.Text = "Call " + translatedNumber;
                callButton.Enabled = true;
            }
        };

        // 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++);
        };*/
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

谢谢

Bad*_*laj 5

我通过添加对

Mono.Android.dll
Run Code Online (Sandbox Code Playgroud)

位于:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v8.1\
Run Code Online (Sandbox Code Playgroud)