Search code examples
xamlxamarinxamarin.android

"The type or namespace name 'App' could not be found" Xamarin Forms


I am trying to create a simple app in Xamarin Android with Xamarin Forms using Visual Studio, however I keep getting this error everytime I try to build. I have double checked my references which should contain the Portable project, as well as made sure I have the latest version of Xamarin.Forms. What could I still be missing that would give this error?

using System;

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

using Xamarin.Forms.Platform.Android;

namespace App2.Droid
{
    [Activity(Label = "App2", Icon = "@drawable/icon", MainLauncher = true,
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity :
        global::Xamarin.Forms.Platform.Android.FormsApplicationActivity // superclass new in 1.3
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            LoadApplication(new App()); // method is new in 1.3
        }
    }
}

Solution

  • Found the source of the error! If anyone else is struggling, try updating Xamarin.Forms using NuGet Packages for Solution. I was only using the Package Manager Console which was not giving me the latest version.