Visual Studio Android Emulator Is Not Running the Application - visual-studio

When I deploy/run the Xamarin.Android app in Visual Studio (either pressing ctrl+F5 or play-button in toolbar), the Visual Studio launches its emulator for android (Note: It is "Visual Studio Emulator For Android", not SDK or any other emulator) without any difficulty and within a reasonable amount of time which works fine. But the problem is that it does not automatically run that app. Neither does it show any icon to run it.

I have not had much success with the emulator built in to VS.
However, you need to switch your output to "verbose" and monitor the output window while it is attempting to deploy. This will give you a wealth of information during the deploy. Likely, your deploy is failing, this will help you figure ouy why.
As a side note, the free Genymotion is a much faster Android emulator that I have had great success with.

Related

development app is deployed on IPhone, but I cannot start it

I have an app in Xamarin that I want to test on a physical IPhone (normally I test it on Android). I'm connected to a Mac, the development certificate is working and everything is deployed to the point that the app is actually installed on the IPhone itself. The issue however is that when I press the icon to start the app, it tries to start it and then is closes right after that (like it crashes or something).
I'm using Visual Studio for Windows, and it is stated that: "XAML Hot Reload encountered a problem and failed to start. Verify the Mono Interpreter for is enabled in the project settings, clean and rebuild the solution.". Mono Interpreter is enabled, I cleaned the solution and rebuild it multiple times. There are no errors given.
The app that is installed now shows the Xamarin icon and Xamarin splash screen (so not the custom one I designed). I don't mind that, but I'm not sure if that has something to do with this.
Does someone know what is wrong here and how to fix it?
Visual Studio for Windows version 17.4.1
iOS version 15.5
Note: this issue is only with the development and deployment directly from Visual Studio from Windows. When the app is distributed to the users (in App Center) the app works as it should.

How to run UWP app on Simulator and simulate a location?

I need to test my UWP application using a simulated location.
I assume that I can do this by running the app on the simulator instead of the local machine, but there is a problem. When I select Simulator, the simulator opens but never finished initializing. It is stuck in a state with a series of dots running across the screen.
In the Visual Studio window, the last message I see is "Registering the application to run from layout". I don't know what that means.
I found some old posts that suggest I need to acquire or renew a license. I checked to make sure that Developer Mode was enabled on my machine and I also ran "Get-WindowsDeveloperLicense" from an elevated PowerShell account, but it did not fix the problem.
Thanks,
Frank
How do I start a UWP simulator?
Your system need to support Hardware-assisted virtualization and
Enable Hyper-v for emulator
Then switch the Solution Platforms to X86 or x64.
For more info please refer Run Windows Store apps in the simulator
simulate a location?
The Visual Studio 2015 simulator does not include the geolocation button. This is because the Windows 10 simulator does not include geolocation simulation. If you need to do this kind of simulation, you can use the Visual Studio 2013 simulator on Windows 8.1 or earlier operating systems.

Microsoft visual studio doesn't show any android emulator or physical device for Xamarin project

I have a xamarin project and i want to debug it, but visual studio doesn't show any emulator or physical device.
this is the menu
I wanted to restart adb from tools > android but it's disabled. but when I open a non xamarin project (for example a web porject) this options is enabled.
I can see my device in cmd with command adb devices and in android studio, every thing is fine and I can deploy some java application to my phone.
do you have Any idea?
Update
I created new project and in this new project, every thing is fine and I can debug with my phone or emulators.
but in my existing project which I'm currently working on, there is no device in list.
It happened to me just now using vs 2019, to fix this, manually remove obj and bin folders restart vs, and that's all :)

react-native and Visual Studio Emulator for Android

is it possible to run react native app on Visual Studio Emulator for Android (standalone) and if yes what are the steps to set it up? I can successfully start emulator, that part works but cant figure out how to config react-native to use it instead of "adb devices".
My current attempts end with error:
Could not debug. Error while executing command 'adb devices': Command failed: adb devices
'adb' is not recognized as an internal or external command,
operable program or batch file.
I know about Android Studio and virtual devices that come with it but I would like to try that as the last option. My environment is: Windows 10 pro, VS Code (with React Native Tools Extension), react-native, yarn.
UPDATE
even though I did not get anywhere in my attempts to make it work
I just would like to share what knowledge I gained while struggling with this issue
because it is possible that my issues are specific to my environment but it might work on another PC.
Theoretically it requires very few steps to run react-native in Visual Studio Emulator for Android
in VS code without installing Android Studio or Visual Studio.
Install Visual Studio Emulator for Android, standalone
https://www.visualstudio.com/vs/msft-android-emulator/
download Android Debug Bridge (adb)
it is included with Android SDK Platform-Tools, download and read more here:
https://developer.android.com/studio/command-line/adb.html
it downloads as zip file, you unzip it and then add a path to adb.exe in PATH environment variable,
so you can execute adb command from any path. I am using yarn and it needs that to know where adb.exe is.
It is kind of a connector between your app and virtual or real android device
it has to be running before you start emulator and basic command are:
to stop - adb kill-server
to start - adb start-server
to see list of devices that adb recognized - adb devices
I also found a specific instruction on how to make Visual Studio Emulator for Android work with adb:
https://msdn.microsoft.com/en-us/library/mt228282.aspx
'Visual Studio Emulator for Android' devices are not listed in the Android Device Monitor
it is a registry edit for key
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools
apparently Visual Studio Emulator for Android is using that and you can create it if it is not there
and just add/modify Path variable to be a path to adb.exe.
now you can start Visual Studio Emulator for Android and after that open integrated terminal in you react native VS code project
and type:
yarn run android
and if I get it right (and in the perfect world) your app should get installed and shown in Visual Studio Emulator for Android,
well, not for me, my emulator never shows up as a device when I type adb devices, all I see is a blank two lines.
So I think I spent enough time on this trying to make it work and in my case the answer to my own questions is:
theoretically you should be able to run Visual Studio Emulator for Android with react-native from VS code but in reality
it probably will not work, so seek something more reliable.
I did see a little light at the end of the tunnel when I tried connecting my phone with USB using expo app, adb picked it up right away,
"yarn run android" started doing something and expo even tried to load my app, I held my breath, my heart was racing, I was ready for a miracle... and .... boom... it just crashed, but this could be easier
for me to resolve though, it appears some networking config issues, my phone does not recognize IP address which was in the output after running yarn
and if this works,(big IF) then it is still good, I can run/debug react-native without using Android/Visual Studio.
Final update:
could not make it work, stopped all attempts and went for Android Studio instead, Android Studio emulators work with react native and expo without any issues. (well, not yet, sample app runs OK at least.)
The same symptoms occurred to me when trying to set both React-Native and VS Emulator for Android together, and the following steps solved them:
On the VS Emulator for Android, I checked my emulated phone's IP at the Tools/Network tab. Emulator Adapter #1 refers to the emulated phone.
Then, I headed to the terminal and ran adb connect <ip_address>:5555. That made the emulated phone available to Android Studio as well as to React-Native.
if you already install android studio
then add C:\Users\manu\AppData\Local\Android\Sdk\platform-tools path into environment path (replace your username instead of manu)
if you have not android studio then
need download adb from https://github.com/intel/haxm/releases/download/v7.0.0/haxm-windows_v7_0_0.zip
then install
intelhaxm-android.exe
.
open a new terminal and now adb commnad will work
it is haxm source website https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm

iOS app flashing and closing on remote debug from Visual Studio

I'm a beginner in iOS development in Visual Studio 2013 through Xamarin.
I made a test app and tried to debug it on the MacBook Pro through LAN remote debugging.
As soon as I debug, the app starts shows launch screen and after 1 second it close, this happens several times and then the app stops.
I'm using xamarin 6.1.4.1 on both machines.
It shows the error : An error occurred while executing the mtouch.
What should I do now??
After going through every things, I re-installed Xamarin Studio by using Xamarin Installer rather than installing individual components. Seems like Xamarin Installer makes some more changes in system other than installing components.

Resources