android – Xamarin – Visual Studio stuck at zipalign.exe-ThrowExceptions

Exception or error:

When trying to deploy an app in Android Device, VS is stuck here:

1>C:\Users\George\AppData\Local\Android\android-sdk\build-tools\23.0.1\zipalign.exe
4 “C:\Users\George\Documents\Visual Studio
2015\Projects\SGUotA-Xamarin\BBXamarin\BBXamarin\BBXamarin.Droid\bin\Debug\BBXamarin.Droid-Signed-Unaligned.apk”
“bin\Debug\BBXamarin.Droid-Signed.apk”

Can anyone propose a solution for this?
screenshot of the problem

How to solve:

I came across the same issue in Visual Studio 2015 using any emulator. In my case, it turned out that I had to change a packaging option to get rid of the problem.

  1. Go to your project settings.
  2. Select Android Options.
  3. Choose the tab Packaging.
  4. Deselect the Use Fast Deployment option as shown in the screenshot.
  5. Hit the F5 key and there you go 🙂

The deployment appears to be a touch slower, however, the emulator executes the software much faster. Enjoy!

enter image description here

###

For those experiencing this on an emulator, if you restart your emulator with the “Wipe User Data” option this issue goes away.

###

None of the solutions present on the web(regedit, clean, uninstall, restart, etc…) solved the issue for me. I ended up reading through xamarin’s bugzilla log and found that the solution is to have the emulator running prior to trying to deploy. If you simply build, then deploy and let visualstudio launch the emulator it will hang. However, if you launch the emulator from the Android AVD Manager then deploy via visualstudio, it will run deploy cleanly.

###

I had the same problem, and after upgrading Android SDK Build-tools from 23.0.1 to a newer version in the Android SDK Manager, the problem was solved.

###

Actually, it seem to be a bug with Xamarin. I don’t know since wich version this bug occur, but i have the same problem since i have updated to the last Builds.

This bug is occuring with my Amazon Kindle Fire. After some test, it seem that this is not really zipalign that is buggy, but the process of attaching to the Device that hang/fail afterward.

In order to be able to debug my Android platform, the only workaround i have found at the moment is to debug via an Emulator. I have used Android_Accelerated_x86 (Android 6.0 – API 23) Emulator that is shipped with the last versions of SDK.

I don’t know if this Emulator is Xamarin related or from the Android SDK, but you can find it in the list of debuggable devices in Visual Studio when on Android platform as startup project.

I can deploy on this Emulator and debug on it. At least we can work and debug till this bug is fixed somehow.

Good luck!

###

ITNOA

When I want install Visual Studio 2017, I remove Visual Studio 2015 first then install Visual Studio 2017 and have a same problem even in emulator, to resolve this problem, I uninstall Visual Studio 2017, then removed Xamarin and Android SDK, NDK completely from my computer, then install Visual Studio 2017 again and my problem resolved.

###

This question may be old but I had this problem right now.
I am using a real device and not an emulator and my solution was to:

  1. Restart Visual Studio
  2. Clean and rebuild the project
  3. Restart the device

Then the deployment worked. I hope this is going to help someone.

###

I’m having the same issue on my Emulator and device and also use the Fast Deployment but still sometime see the issue.

So far, my fix is either clean solution and build then deploy, that sometime will work.
Or, restart my pc, that’s also sometime works.

I don’t have a solution yet, but with combine these two and try many time, it will work.

###

I’m using VS Community 2017, fix it by selecting Use shared runtime that it’s not selected by default.

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *