Michael Bedford Michael Bedford - 20 days ago 15
Android Question

Xamarin Android project builds successfully but will not deploy to emulator

using an emulator (Genymotion) in my case. Suddenly, I cannot deploy to the emulator anymore. I used to be able to just fine. I can however, build successfully AND deploy to a physical Android device no problem. The simulator is running and does show as online in the ADB as well as the play button in Visual Studio. I am running VS2015. As of today, I have:
1. Updated Xamarin for VS
2. Updated Genymotion
3. Updated and verified all android SDK, NDK and JDK versions

After all of that, I still cannot deploy to the emulator but still to a physical device just fine. Attached is a screenshot from the output from the deploy. Can somebody please help, been down all day and pulling my hair out. On a side note, sorry for the screenshot, I originally tried to past in the text and regardless of whether I put it in as code or quote, SO did not like it.

Deploy error

Answer

Just wanted to circle back on this one and officially answer. As indicated in the comments above, you will have deploy issues to either a device or an emulator (most likely on an emulator) when there are libraries that you reference in your app which are either not installed or not supported on the target.

This seems like common sense but the errors you will see are very cryptic and don't clearly point this out. So, if you are having deploy errors such as the one in my screenshot above, check all of your references and components. Make sure they are support by your device and are being deployed. You can try to deploy missing ones manually if Visual Studio is not doing it for you.

For example, Google Play services was mentioned above in the comments. This is a common one because Google Play Services is typically not included in most emulators. Therefore, if you reference these services in your app, it will fail to deploy because the services are not on the emulator. You can then do some searching, there are articles on how to get Google Play services (or any other missing component) installed on your emulator.

In my case specifically, I am targeting a device from Zebra which has a built in barcode scanner. As such, Zebra has provided an SDK for the barcode scanner. Obviously, my emulator does not have this hardware and therefore, the SDK could not be installed. With that, the deploy of my app fails. In this case, I either have to deploy to the actual Zebra device for testing OR remove the SDK reference to use simulator and test all other functions except for barcode scanner.

Hope this helps.