App not run in visual studio emulator for android in visual studio 2015
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:
- Launch the emulator (F5 in VS, then cancel the deployment using the Build/Cancel menu)
- Click on the chevron icon (») in the toolbar to the right of the emulator
- Select the Network tab
- Locate the preferred network ip address
- Back in VS, click on the Open Adb Command Prompt toolbar button
- Type adb connect [the emulator ip address]
- Press F5 again in VS
Looks like a VS bug to me.
Have a look here:
Xamarin Forms Android App Crashes Running Debug with VS Android Emulator
- Start the Hyper-V manager
- Select the emulator you are trying to use
- Right-click, hit settings
- Click processor
- Click Compatibility
- Set checkbox “Migrate to a physical computer with a different processor version”
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.
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
Launch the
Visual Studio Emulator for Android
application from the start menu.Launch one of the available emulators via the green arrow
Attempt to again launch your application from visual studio, selecting the
VS Emulator N-inch...
emulator from the drop down menu
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
- 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.