Share via


Xamarin.Android Projects failed to deploy in visual studio emulator for android

Question

Tuesday, March 8, 2016 9:54 AM

Hi,

I'm using visual studio 2015 update 1 with windows 10 build 10586 TH1.

also I'm using Xamarin Version 4.0.1.96.

I have created a blank Xamarin.Forms app. It deploys to Windows Phone emulators without any issue. But unable to deploy to Android Emulators.

When I start android project Android Emulator launched successfully but visual studio freeze at this step.

I've tried a lot of android emulator profiles but cannot solve the problem.

This problem only exists for Emulators and project successfully deployed on physical android device.

I have the same issue with Xamarin.Android projects.

Here is all of the text in output window:

1>Starting deploy 4.5" KitKat (4.4) HDPI Phone ...
1>Starting emulator 4.5" KitKat (4.4) HDPI Phone ...
1>Validating emulator arguments...
1>Determining if emulator is already running...
1>Preparing virtual machine...
1>Launching emulator...
1>Emulator launched successfully

Thank you in advance for your help.

All replies (28)

Tuesday, April 26, 2016 7:56 PM

I have the same problem. Any solutions?


Saturday, May 7, 2016 9:58 PM

Using the new Xamarin addin for Visual Studio, created a blank project and deployed it to the Android emulator. Emulator loads fine and then nothing happens. App is not deployed. No errors. If I stop the emulator, it tells me deployment failed.


Friday, May 13, 2016 9:48 AM

I was having the same problem, running Visual Studio as Administrator solved the issue.

It is a bit scary that in two months there was no reaction from Xamarin to this issue, though!


Thursday, May 19, 2016 7:24 AM

I'm having the same problem. Running Visual Studio as Administrator couldn't solve the issue. But I could deploy and debug my app by launching VS Emulator for Android manually before deploying.


Tuesday, May 31, 2016 7:21 PM

I am having this problem for the past month or so. adb devices shows the emulator is connected.

VS is running as administrator.

The only way I can get the app deployed is to cacnel the build after the emulator has launched, and then deploy again. This used to work. What's the problem?


Monday, August 1, 2016 2:49 AM

Hey,

Thanks for the reports. Most likely based on your reports, it is one of two potential items:

Either the following issue, which impacts users with Skylake level Intel processors: https://bugzilla.xamarin.com/show_bug.cgi?id=42859

Or the following issue, which occurs when the SDK set within the Windows registry does not match the SDK within Visual Studio: https://msdn.microsoft.com/en-us/library/mt228282.aspx#Anchor_8

Please let me know if it is either (or neither) of those issues.

Thanks!


Friday, August 26, 2016 10:51 AM

I was facing a similar issue! Hitting the Run button in VS did not deploy the app to the emulator. I could get around this by right clicking on the project and selecting the Deploy menu option.


Tuesday, September 20, 2016 3:54 AM

Editing the registry fixed this issue for me.


Wednesday, September 21, 2016 11:22 AM

@JasonVerLinden can you please explain your solution.


Friday, September 23, 2016 11:54 AM

This is my solution:

Check Android SDK path in Visual studio: Tools-> Options -> Xamarin -> Anroid Settings: Android SDK Localtion

goto regedit : HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools change path as above. Restart Visual Studio and enjoy


Friday, September 23, 2016 2:26 PM

@QuocLeTranMinh said: This is my solution:

Check Android SDK path in Visual studio: Tools-> Options -> Xamarin -> Anroid Settings: Android SDK Localtion

goto regedit : HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools change path as above. Restart Visual Studio and enjoy

This fixed the issue for me.


Saturday, October 29, 2016 12:06 AM

@CodyB's registry solution worked for me.

A recent update to Xamarin changed my registry key and I had to redo this change.


Wednesday, November 16, 2016 12:43 PM

@RyanQuocLe said: This is my solution:

Check Android SDK path in Visual studio: Tools-> Options -> Xamarin -> Anroid Settings: Android SDK Localtion

goto regedit : HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools change path as above. Restart Visual Studio and enjoy

Registry fixed this issue for me. Thanks for the solution.


Saturday, May 6, 2017 6:53 PM

I have same problem. I was update xamarin in vs 2015 after then create android app it is show "Could not find or load main class mono.android.AndroidDesignerHost" Connection to the layout renderer failed. Please help me out.


Tuesday, May 9, 2017 11:14 AM

I have tried fixing the registry and running as admin. Still no luck though


Thursday, July 20, 2017 12:00 PM

@MarkBabaylan said: I have tried fixing the registry and running as admin. Still no luck though

Hi Mark.,

After update the registry key do the following. This will solve the issue. It's worked for me. I am using VS2017.

  1. Open Hyper-V Manager and select the VM for the emulator profile that your are using.
  2. Select Delete Saved State (lower right).
  3. Choose Settings...
  4. Expand the processor node and choose Compatibility.
  5. Enable Migrate to a physical computer with a different processor version.
  6. Restart the service (under Actions) and try again.

Tuesday, August 1, 2017 11:21 AM

if you're also having this issue and cant find the registry folder in your registry, run this command in an elevated CMD:

reg add "HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools" /v Path /d %localappdata%\Android\sdk

Then restart your emulator. worked for me.


Monday, August 28, 2017 1:27 PM

@RyanQuocLe said: This is my solution:

Check Android SDK path in Visual studio: Tools-> Options -> Xamarin -> Anroid Settings: Android SDK Localtion

goto regedit : HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools change path as above. Restart Visual Studio and enjoy

This solution perfectly worked for me. Thank you very much for the answer.


Tuesday, November 7, 2017 1:21 PM

Yeah! @JohnOkoroafor works for me! But stops on this line: 1>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\zipalign.exe 4 "D:\luizp\Documents\dev\geracaoagro\com.lpcdev.geracaoagro.gbp\gbp\gbp.Android\bin\Debug\com.companyname.gbp-Signed-Unaligned.apk" "bin\Debug\com.companyname.gbp-Signed.apk"

What im doing wrong?

tks


Wednesday, November 8, 2017 9:45 PM

@luizpcam said: Yeah! @JohnOkoroafor works for me! But stops on this line: 1>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\zipalign.exe 4 "D:\luizp\Documents\dev\geracaoagro\com.lpcdev.geracaoagro.gbp\gbp\gbp.Android\bin\Debug\com.companyname.gbp-Signed-Unaligned.apk" "bin\Debug\com.companyname.gbp-Signed.apk"

What im doing wrong?

tks

That's a bug in Xamarin with Visual Studio 2017. When it gets to this point you can cancel the build then run it again and it should work the second time. You will have to do this once after every reboot.


Saturday, December 2, 2017 12:22 AM

@JohnOkoroafor said: if you're also having this issue and cant find the registry folder in your registry, run this command in an elevated CMD:

reg add "HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools" /v Path /d %localappdata%\Android\sdk

Then restart your emulator. worked for me.

That work for me, just run that command in an elevated CMD.


Friday, March 30, 2018 6:53 PM

does not work for me. this deployment issue literally just started happening. the registry key and the android sdk both have the same path. Any help will be appreciated.


Tuesday, April 10, 2018 11:57 AM

@JohnOkoroafor said: if you're also having this issue and cant find the registry folder in your registry, run this command in an elevated CMD:

reg add "HKEYLOCALMACHINE\SOFTWARE\Wow6432Node\Android SDK Tools" /v Path /d %localappdata%\Android\sdk

Then restart your emulator. worked for me.

This helped me to continue.


Friday, April 20, 2018 5:39 PM

I have the same problem, I've added the value in the registry and it remains the same... :-( I guess a fresh installation of VS2017 will solve the issue, but what a waste of time.

So if someone have a solution


Saturday, April 21, 2018 5:50 AM

I'm also having the same issue, and the SDK path in VS and registry are the same, running as administrator didn't work either Does anybody have a solution?


Sunday, May 6, 2018 5:59 PM

Didn't work, thought I did registry edit and run VS as administrator. Any solution for this?


Monday, July 23, 2018 9:21 AM

For me a previous version of the app was still installed. If you go to your Android device settings > apps, if you see an app with your app package name com.[yourcompany].[appname] You should delete that and try deploy it again.


Monday, December 2, 2019 9:35 AM

Still facing the same issue! in VS 2019.