manasera
manasera

Reputation: 61

The type or namespace platform does not exist in the name space MvvmCross.Forms

I followed the TipCalc tutorial as recommended in the mvvmcross documentation Here, The Core project and UI project works perfectly. But the android MainActivity has errors as it cannot find the namespace

MvvmCross.Forms.Platforms.Android.Core
MvvmCross.Forms.Platforms.Android.Views

Everything appears right but i am unable to figure out what i am doing wrong.

I have installed:

      MvvmCross 6.1.2
      MvvmCross.Forms 6.0.1.0
      Xamarin.Forms 3.1.0.583944

I use TargetFrameWork 8.1 (Oreo)and .net Standard 2.0 I also confirmed in the MvvmCross GitHub repository that the namespace exists.

Here is a peek at

using Android.App;
using Android.Content.PM;
using Android.OS;
using TipCalc.Core;
using TipCalc.Forms.UI;
using MvvmCross.Forms.Platforms.Android.Core;
using MvvmCross.Forms.Platforms.Android.Views;

namespace TipCalc.Forms.Droid
{
    [Activity(
        Label = "TipCalc.Forms.Droid",
        Icon = "@drawable/icon",
        Theme = "@style/MyTheme",
        MainLauncher = true,
        ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
        LaunchMode = LaunchMode.SingleTask)]
    public class MainActivity : MvxFormsAppCompatActivity<MvxFormsAndroidSetup<App, FormsApp>, App, FormsApp>
    {
        protected override void OnCreate(Bundle bundle)
        {

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;
            base.OnCreate(bundle);
        }
    }
}

Screenshot of the error

Here is a Screenshot of the error message

Upvotes: 4

Views: 942

Answers (1)

Cheesebaron
Cheesebaron

Reputation: 24460

Your MvvmCross and MvvmCross.Forms packages are not in sync. They need to be the same version.

Easiest way is to go to the NuGet Package Manager for the solution in VS for Windows and consolidate the packages through the consolidate tab.

If you can't do that you can uninstall the packages, then re-install them.

Upvotes: 1

Related Questions