.NET MAUI app doesn't start in Android emulator - c#

I'm new to MAUI so I followed the instructions on Microsoft's Build Your First App page. I ran the Android emulator and everything worked fine.
I then followed this page to build a flashlight app, but when I ran it, the emulator started fine, but the app never loaded.
In the output window in Visual Studio, I saw this:
[mono] debugger-agent: Unable to connect to 10.0.2.2:54762
I created a brand new .NET MAUI app, made no changes and ran that, same result.
I followed the deployment issues section on this page to no avail.
Also, when I ran sdkmanager --update, I got the following output:
[=== ] 10% Computing updates...
Updating:
platform-tools
emulator
Warning: Failed to read or create install properties file.
[=== ] 10% Installing Android Emulator
where it's saying it failed to read/install the properties file.
I also tried Razwill-1930's answer on this page, again, to no avail.
I'm running .NET 6 in Visual Studio 17.3.5 on Windows 11 Pro.
What am I doing wrong?
Update
I downloaded another emulator and that one works fine, which for my purposes, I'm OK with not being able to use the Pixel 6 emulator that gets installed with the .NET MAUI workload in VS. How can I get it going?

I ended up deleting the emulator (Pixel 5 - API 31) and then reinstalling it.
That worked.
Not sure why that worked, the Android Device Manager didn't re-download the files.
Hey, banging the TV sometimes works too.

The issue is with your emulator, I would highly recommend you recreate the emulator. Points to remember when doing so:
Make sure you have the latest version of the API version's Image
Select Arm64 as your processor (has lesser lag).
Hardware-based GUI has better performance.
Just FYI Assigning too much RAM won't make it faster

Related

Xamarin Emulator - System UI isn`t responding

I am new to Xamarin development but want to learn the basics. I can't make my android emulator Pixel 3 x86 Android 9 Pie to open and see the very default app. System UI isn`t responding is the main error. I tried almost everything I've found online. I have considered installing an older version of VS but I am not sure. Can you help please?

Why can't I debug a simple Xamarin app that targets Android?

I am trying to create a simple Xamarin app on my Windows PC targeting Android and it is proving to be a real pain with problems at every single step of the way (no single step was without a lot of pain). I am now at the step where I am trying to start the device as shown below:
When I try to start this device I see the following error:
I have been trying to sort this error for the last 1.5 days with no luck. I have come across this webpage, which talks about the error: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/troubleshooting?pivots=windows#accel-issues-win
Therefore I run the following command:
"C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe" accel
I see this:
Is this telling me that my CPU is not suitable for Xamarin development? My research is telling me that this is just warning me that debugging could be slower.
I have also come across this: https://visualstudio.microsoft.com/vs/msft-android-emulator/. I have installed it, but don't really understand what it is needed for because the Emulator appears to be installed as part of Visual Studio:
Now see the image below:
Notice I have enabled Hyper-V and Windows Hypervisor Platform.
What is the problem? Please note that I have created a basic HelloWorld type app i.e. using the project defaults.

can only debug not deploy xamarin app with System.Data.SqlClient class used

I'm working on an android app in Xamarin. It will debug in VS2013 community absolutely fine, deploying it to my phone on a usb tether. However I try and deploy a full .pk file set for a website download (I know the user would have to agree to installing 'untrusted apps') after I go through a standard deployment via VS2013, I try a 'dry' installation via download from a site, this doesn't work. It starts fine, and runs up until an sql-command is executed (namely logging in). Not sure how to resolve this one. Any help would be great.
So after some research the answer is simply to turn on 'west' as an option in project properties.
If this fails however this is a bug, and due to be fixed in 4.3 ? (apparently)
more information: http://forums.xamarin.com/discussion/25/problem-inserting-data-in-sql-server-in-release-mode

AndroidManifest.xml does not merge activity info upon Build

Pretty new to Mono for Android (C#), and I'm seeming to have trouble during one of their tutorials where it mentions that info on Activities is merged into AndroidManifest.xml upon compilation.
The FirstActivity class is set to Compile upon Build, yet no AndroidManifest file is created. One can be created via the Project menu but it doesn't include any information on Activities and does not update when these are changed.
Had a look around on the internet but I only managed to find issues relating to Visual Studio.
Any help would be appreciated! :) Thanks.
edit: I'm using the evaluation version right now, if that's any problem.
edit: Getting more problems it seems. Had trouble accessing the AVD through Mono and decided to reinstall the Android SDK to the latest version. Attempts to run the program on the emulator cause the 'Devices' list to disappear shortly after emulator startup (or, at the very best, it fails to acknowledge that an emulator is active). running 'adb devices' spits out the correct emulator "emulator-5554" or something, but Mono's just repeatedly failing to notice.
It's correctly pointed to Android SDK and Java as far as I know.
The AndroidManifest.xml that is generated is created in:
obj\Debug\android\AndroidManifest.xml
The one in your project is not touched.

Android application does not works: "The xx.xx application (xx.xx process) stopped unexpectedly. Try again

Well, I'm getting started in applications android development, as I'm familiar with C#.NET(and I love it), I decided to use the fantastic MonoDroid project. I downloaed and installed,worked fine until now. I created hello world application, using MonoForAndroid_API_8 emulator device, worked fine.
then I copied *.apk files and installed in my tablet with android OS 2.2, but when I run my application,I get the following error:
The xx.xx application (xx.xx process) stopped unexpectedly. Try again.
how to fix this? Any help is very appreciated. Thanks in advance.
You can find information here about how to view the Android logs.
I'll take a guess at what your problem is though, without having seen the logs. Are you using the full version of Mono for Android or the evaluation? The eval doesn't support deploying to an actual device.
If you are on the full version, is the APK from a debug build or release? Debug builds are made to use a shared runtime to make deployments quicker, but it means that the APK doesn't contain everything the app needs to run. Release builds don't use the shared runtime, so the Mono runtime is bundled with the APK.

Categories