T PHo
T PHo

Reputation: 89

Error CS0234 The type or namespace name 'Platforms' does not exist in the namespace 'MvvmCross' (are you missing an assembly reference?)

Hi I'm newbie in MvvmCross framework and Xamarin.Android development,

I try to follow the TipCalc Android Project tutorial https://www.mvvmcross.com/documentation/tutorials/tipcalc/a-xamarinandroid-ui-project via this link

However, after I created the Core project, and added the "MainApplication.cs" to the Android Project in the solution (Installed both MvvmCross version 7.2). I cannot reference Platforms package inside MvvmCross.

It gives me the error,

Error CS0234 The type or namespace name 'Platforms' does not exist in the namespace 'MvvmCross' (are you missing an assembly reference?)

This should be a simple app tutorial but it has been making me stuck for 2 days. Does anyone have an idea?

MainApplication.cs

using System;
using Android.App;
using Android.Runtime;
// These next 2 aren't found
using MvvmCross.Platforms.Android.Core;
using MvvmCross.Platforms.Android.Views;
using TipCalc.Core;

namespace TipCalc.Droid
{
    [Application]
    // So this MvxAndroid... is also not found
    public class MainApplication : MvxAndroidApplication<MvxAndroidSetup<App>, App>
    {
        public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
            : base(javaReference, transfer)
        {
        }
    }
}

I added MvvmCross as an assembly reference, but these namespaces aren't showing up. What's going wrong here?

Upvotes: 0

Views: 2593

Answers (3)

Cheesebaron
Cheesebaron

Reputation: 24460

If you are updating an old solution, make sure you change your Android Application project to target Android 10. Otherwise the NuGet package won't install properly for the Android Application. If you are still using packages.config, you may have to uninstall the packages and install them again after changing target.

You can reference the TipCalc sample here: https://github.com/MvvmCross/MvvmCross-Samples/tree/master/TipCalc

Upvotes: 1

T PHo
T PHo

Reputation: 89

Although the reece was correct when there was a codebase change for version 6.0.0 of MvvmCross, the actual solution to my problem, in order to get the tutorial to work is downgrading MvvmCross package in Nuget to 6.2.1. I haven't tested with any other versions but 6.2.1 worked for me.

Upvotes: 0

Recently the mvvmcross namespaces were changed

it shows that MvvmCross.Platform was changed to MvvmCross

the changelog

Upvotes: 1

Related Questions