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:
- CommunityToolkit.Maui Version=”9.0.2″
- Microsoft.Extensions.Hosting Version=”9.0.0-preview.6.24327.7″
- Microsoft.Extensions.Hosting.Abstractions Version=”9.0.0-preview.6.24327.7″
- Microsoft.Maui.Controls Version=”9.0.0-preview.6.24327.7″
- Microsoft.Maui.Controls.Compatibility Version=”9.0.0-preview.6.24327.7″ Microsoft.Extensions.Logging.Debug Version=”9.0.0-preview.6.24327.7″
- Microsoft.Maui.Essentials Version=”9.0.0-preview.6.24327.7″
- Microsoft.Maui.Graphics Version=”9.0.0-preview.6.24327.7″
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.