Reputation: 199
So there is this new thing of Microsoft wanna-be React Native https://learn.microsoft.com/en-us/dotnet/maui/
Right off the bat, I was trying to get it working with Visual Studio 2019.
I was following .NET 6 previews, and the blog posts of David Ortinau (the Principal Program Manager, .NET Multi-platform App UI)
It has been four or five years since I last time had a look at Xamarin, at which point I decided it was a disaster, and gradually moved to React Native as a choice of cross-platform mobile UI.
Visual Studio 2019
But after few hours of wrestling with Hyper V, and Visual Studio installer, I was able to run a simple Xamarin app, on an Android emulator. It was super slow tho, even after switching to Intel HAXM.
At this point, I think it's appropriate to ask: what's the deal with Android Device Manager on Windows vs Visual Studio Emulator for Android? They kinda seem to do the same thing, so it's confusing.
Even though the .NET 6 preview 4 states the support, after hours of wrestling with the maui-check tool, I finally gave up on VS2019, and completely uninstalled it from the system.
Visual Studio 2022
I installed Preview 3 (the latest version atm) and followed the installation guide (https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation) step by step all the way.
Was able to run Xamarin Android app. And open a new MAUI project, but running it got an error message:
It looks like you are using an incompatible JDK. Please install and configure Microsoft Mobile OpenJDK.
Which I was able to resolve with the help of this advice: https://developercommunity.visualstudio.com/t/issues-creating-android-emulator/1467306
Unfortunately, that didn't help me much further
Building the solution now required iTunes and Apple Developer account, for hot restart. Luckily I was able to disable that from the options > xamarin > ios
But I was still unable to build Android target. Editing the raw project file (btw, kudos for the VS team for scraping all the overload), removing didn't help either.
I still got
XamarinShellPackage did not load correctly
And when trying to still run the project:
error MSB4057: The target "Run" does not exist in the project. build failed
Upvotes: 0
Views: 1444
Reputation: 199
Hours later, I got to the root cause of it, thanks to noticing that the Options > Xamarin didn't even open anymore.
And it was, that installing the new JDK from Oracle had changed the path so that it was only accessible for Xamarin projects, but apparently, MAUI type project is only looking at C:\Program Files\Android\jdk-16.0.2.7-hotspot
So I got the latest version on JDK from Microsoft to the above-mentioned path.
And the MAUI Blazor is working - finally! :)
Upvotes: 4