App not run in visual studio emulator for android in visual studio 2015
Asked Answered
B

10

23

I create blank xamarin android project without add any code when i debug this project debugging without problem but when i run app with visual studio emulator for android emulator is running but not starting my app and deploy failed and don't show me error

why ? please help me

Breda answered 14/9, 2015 at 9:0 Comment(5)
it can be due to many reasons, it there any error message, warning you can put it here for us in order to help youBootblack
don't show me warning just write deploy failed ... :|Breda
i think visual studio can't run app in emulatorBreda
Possible duplicate of Visual Studio 2015 Xamarin deploy fail without any error messageVan
Do you have Windows 8 or higher? As far a i know i wont run under Windows 7.Wakerobin
D
49

I had the same issue. VS 2015 can launch the VS emulator but can't deploy the app.

I was able to solve the issue like this:

  1. Launch the emulator (F5 in VS, then cancel the deployment using the Build/Cancel menu)
  2. Click on the chevron icon (») in the toolbar to the right of the emulator
  3. Select the Network tab
  4. Locate the preferred network ip address
  5. Back in VS, click on the Open Adb Command Prompt toolbar button
  6. Type adb connect [the emulator ip address]
  7. Press F5 again in VS

Looks like a VS bug to me.

Dorindadorine answered 14/9, 2015 at 11:48 Comment(6)
Exactly what I needed!Ise
Spent like a whole day trying to figure this one out. You're solution did it.Glidewell
Thx for the answer. Worked for me!Scala
It also worked for me! Good Job! but need to do it in every deployment.Dumfries
I cannot found chevron icon too.Dauphin
Thanks for that! Got this issue when reinstalling all the xamarin stuff on a new laptop. Eventhough it's working well with same versions on old laptop. I am still looking for the root cause and permanent fix. Still valid with VS 2017 15.8.8Fluoridation
G
13

I had the same issue. It turned out the root cause was that the VS Emulator couldn't find adb.exe.

When that happens it won't connect to the emulator unless you do the manual connection following the steps CSharpRocks gives. The emulator also won't be listed under "adb devices".

The fix for me was to reinstall the Android SDK, using the Windows EXE based installer (not the zip installer). The EXE installer sets the HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools key, Path value, in the registry, pointing to the Android SDK root directory.

The VS Emulator uses that registry setting (or the Android Studio install registry setting) to find the SDK, assuming you didn't install the Android SDK with Visual Studio itself. With that, it should be able to find adb.exe and work.

Gurango answered 22/1, 2016 at 3:6 Comment(1)
This was the same method that suggested by Microsoft (This is the link) and it worked for me and solved the issue permanently.Dumfries
A
8

Have a look here:

Xamarin Forms Android App Crashes Running Debug with VS Android Emulator

  1. Start the Hyper-V manager
  2. Select the emulator you are trying to use
  3. Right-click, hit settings
  4. Click processor
  5. Click Compatibility
  6. Set checkbox “Migrate to a physical computer with a different processor version”
Applejack answered 13/5, 2016 at 17:41 Comment(1)
This was the answer that worked for me. Good effort.Renn
R
4

I'm having a very similar issue. I have found two different kind-of-work-arounds, but have not yet figured out a full solution.

Start the emulator before trying to deploy to it

  1. Launch the Visual Studio Emulator for Android application from the start menu.

  2. Launch one of the available emulators via the green arrow

    Visual Studio Emulator for Android

  3. Attempt to again launch your application from visual studio, selecting the VS Emulator N-inch... emulator from the drop down menu

    Visual Studio Emulator List

For me for some reason the app still doesn't "launch" on the emulator, although it is installed. So I have to open the application menu and select my app. Additionally it will usually crash the first several times I try to open it, but eventually displays my single default label, Welcome to Xamarin Forms!.

Run the application in Ad-Hoc mode

  1. Before running the application, change the solution configuration (from the top toolbar next to the green "run" button) to Ad-Hoc.


The problem with both of these methods though is that I'm still not able to actually debug an application. I can run it, but my breakpoints are ignored and I think that will make finding bugs difficult once I actually start to write a real application.

I hope to update this answer once I figure out an actual solution.

Rabjohn answered 6/5, 2016 at 22:39 Comment(1)
Thanks so much - Starting the emulator before trying to deploy to it fixed it for me...Anodyne
C
3

I had the same problem yesterday. The problem appeared (probably) because I tried to start development after a long break. I updated VS and everything, but faced many issues.

Eventually you need to start fresh

  1. Make sure SDK for emulator points to the right place (HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools)
  2. Run Visual Studio with Administrator privileges
  3. Go to Hyper-V Manager and delete ALL Virtual Switches - let the system recreate them when needed. It will do it properly
  4. Delete all existing emulators and recreate them in Visual Studio. I even found a comment to name them without spaces - not sure if it is needed, but wouldn't hurt.

Doing all this helped me. But I was on the verge of reinstalling Windows 10 clean. I think lots of things and configuration changed and are no longer compatible.

Ceresin answered 1/11, 2016 at 1:55 Comment(0)
D
0

Try it enabling Hyper-V and using a Visual Studio Emulator from android; that worked for me after a lot of attempts and research

Distorted answered 12/10, 2016 at 1:50 Comment(0)
G
0

I had the same issue but in my case it was not the registry. After doing a release build, I deployed the app to the emulator device in release mode which pushes the app to the device and then effectively "disconnects". This leaves a version of the app on the device which seems to block further attempts at debugging or deploying.

I solved it by starting the emulator, going to "settings -> apps" and manually uninstalling my app. Then the next debug build & deploy worked again.

You could probably also manually start the emulator and say "wipe device" option so it starts fresh.

Grendel answered 8/12, 2016 at 16:21 Comment(0)
H
0

In VS2017, on a Windows10 machine, all I had to do to get the app to show up was turn off Mobile Data. (swipe down or use settings, then click Mobile Data and confirm to turn it off).

After I turned it back on, I could access the app. Before doing this, it always seemed that the emulator ran, but wouldn't run the app.

... no idea why this worked, but I'm posting it here in case it helps someone.

During my troubleshooting process, I also looked at these articles:

Heterozygote answered 18/7, 2018 at 18:20 Comment(0)
C
0

Install apache in VS 2015 here.
Visual studio requires apache to develop android apps.
You also may want to look at some other suggestions:
notshowing, troubleshooting

Confound answered 7/7, 2020 at 19:37 Comment(0)
S
-1

I had such issues before with the android SDK emulator, now I'm using Genymotion emulator instead of it, it is more light and faster and will be detected automatically by you VS once launched.

you can download the free version from here : https://www.genymotion.com/

and also you can download any device emulator.

Sulamith answered 27/8, 2016 at 8:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.