0

It's began after Xamarin updating

After creating Xamarin forms (Blank Xaml App) project in VS2015 I'm trying to start this project in debug mode with out any changes.

And, in the time of starting compiled app on device I'm getting this error: "element is not of type xamarin.forms.view" ( see attachment)

I've tried different devices (emulators and real). I've tried rebuild all solution and android project itself. I've tried reopen project. I've updated all android SDKs.

Nothing is helped, I'm getting the same error every time I start project

Please, help me! I don't know what's the problem I can't work right now because of this error, I can't start any new project

Here is the code from portable dll:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace App3
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();

            MainPage = new App3.MainPage();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}

And, here is the code from main activity:

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

namespace App3.Droid
{
    [Activity(Label = "App3", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
    }
}

MainPage Xaml code:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:App3"
             x:Class="App3.MainPage">

  <Label Text="Welcome to Xamarin Forms!"
           VerticalOptions="Center"
           HorizontalOptions="Center" />

</ContentPage>

MainPage C# code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace App3
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }
    }
}
Art
  • 11
  • 3

2 Answers2

1

Thanks to everybody! Here is the solution of the problem:

  1. To Upgrate Xamarin.Forms Nuget Package of all project to lastest version ( 2.3.2.127) and it is need restart your VS2015.

  2. To clean build of Android project.

  3. Run Android project and it work fine.

Art
  • 11
  • 3
1

In my case, I solved it by cleaning and then rebuilding the whole solution.

Nevertheless, I guess it should work by doing that only with the Xamarin.Droid Project.

ndarriulat
  • 749
  • 1
  • 9
  • 11