Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App not run in visual studio emulator for android in visual studio 2015

Tags:

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

like image 631
m.h.bayan Avatar asked Sep 14 '15 09:09

m.h.bayan


People also ask

How do I enable Android Emulator in Visual Studio?

Just open up the Visual Studio Emulator for Android entry in your Start Menu, hit play, and the emulator is ready to debug from any IDE. Download the standalone emulator today!

Why is my Android Studio emulator not working?

If the Android Emulator does not start properly, this problem is often caused by problems with HAXM. HAXM issues are often the result of conflicts with other virtualization technologies, incorrect settings, or an out-of-date HAXM driver. Try reinstalling the HAXM driver, using the steps detailed in Installing HAXM.

Can I use Android Studio emulator with VS code?

Step 1: Go to the Extensions button on VSCode and search for Android and iOS Emulator and install it. Note: Change the Emulator path windows address based on the location of the emulator file on your PC but make the Emulator path as default it would be given as default by the VSCode.


2 Answers

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.

like image 108
CSharpRocks Avatar answered Sep 21 '22 17:09

CSharpRocks


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.

like image 25
Bret Johnson - MSFT Avatar answered Sep 20 '22 17:09

Bret Johnson - MSFT