Reputation: 92
My .NET MAUI application suddenly stopped working when I tried to compile and debug it on a emulator.
I am being told that the namespace MauiApplication
in /platforms/android/MainApplication.cs
can't be found, and I don't understand why, since I did not change anything before the error occured. Simmilar errors occur when I try to debug on Windows/other Android Emulators.
using Android.App;
using Android.Runtime;
namespace MAUI_Testing
{
[Application]
public class MainApplication : MauiApplication //MainApplication is not found
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
I have installed the following nugget packages:
I know that some of these packages are unnecessary, but I tried fixing hte error by installing a bunch of packages that were mentione din articles related to MauiApplication and simmilar errors. I am new to .NET MAUI and don't reall know if this is my fault or just something being outdated/misconfigured. If you need more information, please ask for it. EDIT: I tried creating a test project, and it has them same error. What should I do? Reinstall Visual Studio? Use another device? Reinstall Windows?
Upvotes: 0
Views: 454
Reputation: 92
I found the problem myself: I updated my Nuget packages to V 9.x while using .NET 8.x. A downgrade resolved the problem. Never install the preview versions.
Upvotes: 0