After migrating my project from Xamarin.Forms to .NET MAUI as instructed by this article, I could deploy it to Android Emulator just fine, but when I pushed it to a new branch in Gitlab, clone it to a new local folder and deploy it to Android Emulator, I got this error from the cloned project solution's Output window. The build was successful, but not so for deploy.
1>------ Deploy started: Project: x.Android, Configuration: Debug Any CPU ------
1>Please select a valid device before running the application.
1>Deploy failed
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
My OS is Windows 10 and I use Visual Studio Community 2022 Preview (ver. 17.3.0 Preview 1.1). My Android Emulator is Pixel 5 - API 31.
I'm aware that similar questions have already been asked multiple times, but most of them were dedicated for iOS and I couldn't find the solution for Android. I've tried rebuilding my solution, unchecking and rechecking all the checkboxes in Configuration Manager, updating Android SDK, factory reset my emulator, and restart Adb server, but none of these worked.
I've also checked my selected emulator and from the looks of it, VS 2022 Preview detected my emulator just fine as shown by this image
Outside of this project solution, VS 2022 Preview can run .NET MAUI projects without problem, with my Android Emulator's name replacing the "Start" button. Additionally, I can also switch between two Android Emulators (before I deleted one) when I open natural .NET MAUI project solutions, something I can't do for this migrated project. The dropdown just closed without doing anything, with check mark on the left of my emulator's name not moving to the newly-chosen emulator.
I'm not sure whether it's caused by VS 2022 Preview, my emulator, or my migrated project. Any help would be appreciated.